Graphics • 1:12:23
Learn of the capabilities that make it simple and natural to work with QuickTime in the Cocoa environment. If you use QuickTime in your Cocoa applications or would like to enhance your products with QuickTime's multimedia capabilities, view this session to learn all about the new Cocoa developments from the QuickTime engineering team.
Speakers: Ian Ritchie, Tim Monroe, Tom Maremaa, Kevin Calhoun, Adrian Baerlocher, Michael Johnson
Unlisted on Apple Developer site
Transcript
This transcript was generated using Whisper, it has known transcription errors. We are working on an improved version.
Well, welcome to the session. My name's Ian Riitchie. I've had the opportunity of managing part of the QuickTime engineering team this last year, actually for a number of years. We decided to... In fact, some of you were here last year and we mentioned that we're working on a new set of Cocoa classes for QuickTime.
We listened to your concerns. We heard NSMovie and NSMovieView had some issues you wanted us to take care of. We said, well, how are we going to do this? Because we're QuickTime engineers. We know QuickTime inside and out. We didn't know a lot about Cocoa. So we actually, the whole team took Cocoa classes and we met with the Cocoa development team, Olly Ozer and Andrew Platzer and others. And a lot of direction from even executive management on how to work on these classes. And we'll explain today what we've come up with. You're going to learn about the new APIs that we offer.
Tim Monroe will come up and talk about the classes. We'll show you some sample code that we worked on. Like what could you get working on today, you know, just after a few minutes you have it on your DVD. And then we'll go into what if you had a few days to work with this. Some things we came up with these last few days after we finished working on the seed for your
[Transcript missing]
When we tried to use these, just like real fast, you ran right into Carbon. You go, "Oh no, I've got to idle a movie? Well, I don't know about that. And what's a handle?" You know, since Mac OS 9, most people don't know these, or aren't used to using these structures and data types. So, you ran into limitations that we decided to address.
And of course there were an occasional bug or two in the old classes. So you've probably heard Apple explain, "We're committed to Cocoa. We want you to use Cocoa. If you're going to develop an application on OS X, use Cocoa." And they mean it. We develop an application on both OS X and Windows, the QuickTime player, and we are committed to developing the QuickTime player for OS X in Cocoa.
I'll explain in a minute how we did that. We developed the QuickTime broadcaster. A lot of the iApps that you see, iPhoto, iMovie, other apps we have at Apple, are using Cocoa. So we encourage you all to embrace this technology, and Apple is committed to providing access to other parts of the OS in Cocoa classes.
We looked at it as a Cocoa programmer would. We removed all the carbonisms. So you can get up and get running in no time with your Cocoa background. This next, well, where possible, we adopted the Cocoa model. There's a few places that we'll tell you about that we made exceptions. And we also provided a new palette to Tim Monroe will go through in a little bit that will show you the new functionality. So on the abstraction, we have to deliver QuickTime virtually everywhere.
We have 90, 95% of our users are on Windows. So when you're developing an application, we said, well, where do we put the code? Where do we put most of it? We push it down into QuickTime as much as possible. And then above this, we have-- Two layers.
We have an ActiveX layer and we have a Cocoa layer. And one of the layers here today that we're going to talk about is the Cocoa layer. That's what we built the player up on, both for Windows and Mac. So your application should be relatively QuickTime agnostic and just use the classes and be able to get up and running in no time.
I'd like to introduce now, I even wrote some of these things down, one of the Apple premier's multimedia engineers. This is all in print. You can look it up on the internet. He is the resonant QuickTime guru in many circles, an author extraordinaire. You've seen many of his articles in Mac Tech and he's also written the QuickTime Toolkit, Volume 1 and 2. I encourage you to run out and get this book. Let's bring him up now here. Tim Monroe, he's also the tech lead of the QuickTime tool kit. of the QuickTime Cocoa Kit. Come on up, Tim.
Thank you, Ian. What I want to talk about here is briefly go through the kit, give you an overview of what classes are in it, and then I want to do a real quick demo that shows how to use the kit, and then I want to get out of the way so that the really fun demos can come forward. So there are five classes in the QuickTime for Cocoa kit, and there are two data structures. So let me start down toward the bottom with the data structures, because we'll need those when we get to the classes.
We are providing a data structure called QT time that is going to be our preferred method for indicating a time or a duration in a QuickTime movie. And you can see there's three fields here, a time value, and the time value is interpreted relative to the time scale, which is the number of time units per second.
And finally, we've added a flags field here, and this allows us to do some interesting things like indicate that a time that we're passing back to you is not really a valid time or is perhaps an indefinite time. This might happen, for instance, if you ask for the duration of a streaming movie. It doesn't really have a duration, so we might pass you back the flag that it's indefinite, and you can see the QT time is indefinite flag there. So let's go ahead and start.
So we have a bunch of utilities for creating QT time structures, for adding them together, for comparing them. We've tried to do everything as much as possible in the Cocoa flavor. And there are two predefined QT time structures that you will be working with, namely QT zero time, which is a zero time or duration with a non-zero time scale, and then the QT indefinite time, which has that flag, that bit set in the flag. Thank you.
If you take two QT time structures, try that fast, and put them together, you have a QT time range. And that indicates a start time of the range and the duration of the range. And once again, we have a number of utility functions that you can use to operate on time ranges.
For instance, QT time in time range will give you back a Boolean value. And finally, we have added categories on the NSCoder class that allow you to encode or decode QT time ranges and QT time structs. So when you archive or unarchive objects, you can add these items in.
So let's get to the classes now. The main class you'll want to work with is QtMovie. This represents a QtMovie and movie controller. We don't see any use in separating those two items into separate classes. There are quite a number of ways to create a QtMovie instance. I've got some of them listed here. If you have a movie in a file, you can give us the file name. If you have a URL, we'll take that.
If you have a QtData reference, which I'll talk about in a second, we can initialize a QtMovie object from that. NSData. Or finally, if you want to put a QuickTime movie in your nib, we also have this method, MovieNamed, which you may recognize as similar to the ImageNamed method for reading the movie out of your nib file.
So once you've got a Qt Movie object, we have a large number of... methods that you can use to navigate within the movie or to get movie attributes. Let me just talk about the attributes for a second. There's a few methods that will give you a specific attribute directly. For instance, the current time method will give you back a QT time structure, which represents the current time.
Now we could have defined methods for all the very many attributes that you might want to get, but we haven't done that. What we will give you is an NSDictionary that contains key value pairs of a large number of keys and the associated values. If you just want one particular attribute, then there is a method, movieAttributeForKey, so you can pass a specific key and we'll give you back the associated value.
So if you have a movie, you can also get an array of tracks in that movie. And finally, if you need to go underneath the kit, if there's something the Qt kit doesn't do, and you really like working with those Carbon APIs, you can get the movie or the movie controller identifier and use that in your code.
The next class we're talking about is QT Track. As you know, a QuickTime movie is composed of tracks, so we will give you back, if you wanted, a list of tracks of QT Track objects in the movie. Now, there's only one way for you to create a QT Track object yourself, and that's if you already have a QuickTime track. You can initialize a QT Track object from that existing QuickTime track.
The way that you get and set track attributes is exactly parallel with the way that you do it with movie attributes. Finally, you can get the media object that's associated with the track. And also, in the case that you need to go underneath the kit and work directly with the QuickTime track, you can get that track identifier.
Not much to say about media. Each QT track has one media associated with it. Again, if you want to create a media, there's only one way to do that, which is to start with an existing QuickTime media and call it the "init with QuickTime media" method. Media attributes work just the same way as movie and track attributes. You can get the track associated with the media. And finally, if you need to go underneath the kit, you can get the media identifier.
There's a Qt data reference class, which I don't want to say much about because we'll talk about it a bit later. But the standard way of talking about, of referring to data in a movie is with a data reference. So we'll talk more about this later. And finally, the view object that we'll be working with is QtMovieView. It's a subclass of NSView that is associated with a particular Qt movie object.
I've listed some of the attributes that you can get and set. We'll look at this more in a second when we get to Interface Builder. And finally, there's a large number of IB actions that you can wire up to menus or buttons in your interface. So that's really the kit. They have asked us to mention a few issues that you will run into if you start working with the version of the kit that's on your DVD.
And I've listed three of them here. There are some cosmetic drawing issues that you'll run into that you won't see here today because we have a fixed version of it. Currently, you cannot usefully subclass a Qt movie view and get the event handling to work just right. And finally, I would not recommend trying to rotate a Qt movie view right now. So let's go to a demo with this.
And I'm going to show you with six lines of code just how easy it is to write a multi-document QuickTime display and editing application. So let me launch Xcode here, and I'm going to ask for a new project, and I want a new project that is a Cocoa document-based application. Let's call this Demo.
Tell me you're crashing. There we go. I'm a pessimist. Let me open the .h file, and I'm gonna need one instance variable here. Actually, first I need to do this. When I'm using the kit, I need to, of course, include QtKit.h. And then I'm gonna wanna have one instance variable here. I want a QtKit.h.
[Transcript missing]
This will work. So let's save that. That's all I need to add to my .h file. Let's go into the .m file and save that. And so I'm going to be loading Windows from nib files. So I want to come down to the window controller did load nib method and add a few lines of code.
[Transcript missing]
I want to do something, and that is to create a Qt movie. And let's call that movie. And how am I going to create that? I'm going to call the class method QtMovie, movie from file. And what file? Self file name.
And if I get a movie, I'm just being careful here, I want to assign that movie to the movie view which is going to be loaded. So I will say movie view set movie to movie. and I believe I'm done with my code, so let's save that. Now I need to set a few things in my target here. First thing I want to do is when I'm building, oh goodness.
I don't want to do the precompile, the prefix header, because that'll take too long. And finally, I want to set my document type so that when the open file dialog comes up, I can open MOV files. And that's all I need there. I could add in other document types here, but I'll refrain from that. So let's see if I can build this.
Bill Succeeded, most excellent. But I'm not quite done yet, 'cause I need to set up my user interface. So let me open the document nib. I'm gonna get rid of that text thing. And the first thing I wanna do is resize my window. You'll notice that I didn't put any code into my source file that resizes the window to fit the movie. So I'm going to set this. I'm going to set the size of the window to a known size that will fit my movies.
Okay, and now I want to drag a movie view object into my window. Set it down here. I want to set its size to resize to fit the movie window when I resize it. And I'll list a few attributes on the movie view. You can see I can show or hide the controller. I'll show it. And I want to make this editable. And I need to do one last thing. I need to set up an outlet for the file owner. So I'll come in here and add an outlet and we need to call that movie view.
Now let's come over here and wire it up. I will control click, make the connection. Save that. And if the demo gods are smiling on me, I can go ahead and run this. And demo is running and there is an... So let's now go over here to the open file and open a movie file.
Very good, thank you. One thing you cannot forget to do is add the QtKit framework to your project. or it won't run, so we're going to go to system library. Frameworks. Look down here for the Qt Kit framework. Add that to our project. Yes, now let's build and run.
And now things are working fine. So I can open, let's open that one that I tried to open before. Movie from File. Ah, thank you. It's not Movie from File. You'd think I'd know this stuff now. It's Movie with File. Okay. Now that we've got that, let's go ahead and start the session. Let's try running this. Oh, I'm still running it there.
There we go. Now this should work. Let's cross our fingers. Open that. Bingo, we've got it. This is actually a Flash file. One thing let me show you real quickly. In the keynote on Monday, I showed you that there's a contextual menu for movies. And if I control click in this, this is a Flash movie, I actually get items here that are relevant to Flash. So I can zoom in, zoom out, and so forth.
All right, let me very briefly show you one more thing. And this is to show you that the kit provides you a large number of behaviors for free. Okay, so I've opened three movies here. I have two VR panoramas. And let me line this up just right. So this is Donner Lake in the winter and Donner Lake in the summer. And that's exciting. So let me try opening that again.
So something is missing here. What I had was a wired sprite movie that sent messages to the two panoramas to tell them to pan. So I can't do that here because the movie isn't opening correctly. But that illustrated one thing that you get for free with the kit, which is automatic intermovie communication. So with that, bumbling through, let me bring up Tom Maremaa, and he will discuss what you can do, hopefully with more success, if you've got an afternoon to play with the kit. All right, Tim.
Where is the clicker? Is this it? Tom Maremaa, I write technical documentation for Apple. I've been working with the QuickTime team for the last seven years and this is just awesome stuff. I decided to see what I could cook up with the framework basically in an afternoon. Whoops, that was too fast. How about going back here? And I wanted to basically build a little QuickTime kit media player app in Tiger, something that was tasty, easy to cook up and wouldn't burn my fingers.
I basically wanted to do an app that could play, display QuickTime movies, import/export, and also do some editing beyond simple copy and paste. And this would involve maybe a couple hundred lines of code. So what did I need? Well, first of all, Tiger cookbooks. Yes, we have some Tiger cookbooks to work with a QuickTime kit framework. Second thing is sample code, which you can download, which is a piece of cake, and some basic Cocoa programming.
Third thing, ingredients. Start with Xcode, obviously. Make sure Panther or Tiger is installed. And the key is add QuickTime 6.6. And then we're going to bake it up with the new classes. When completed, invite friends over to watch and enjoy my player app doing its thing. Finally, all the documentation, the reference, and the programming guide is available, plus the sample code that I used to build this app.
Notice that We have not included the 3,300 pages that are part of the procedural C API. You won't need that. Nor will you need the thousands of other pages that we've written over the last 10 years documenting this awesome QuickTime technology. So, can I go to the demo please? Whoops, that's going. Okay. I'm going to just close. I think this is Tim's stuff.
This is my QtKit player app and as you can see, I have added my QtKit framework, which is what Tim was showing. This is basically an app that was cooked up in a couple of days. And what I want to show you is just a few features that are unique to it.
[Transcript missing]
I'm going to do is show you what you can do as far as adding some of the actions. As you can see, I have specified my fill color as blue. I'm showing my controller and I'm not going to be showing the editing part yet. Let me just go back to this and I want to show you what I've wired up here.
Hey, this is the cool stuff that comes with the kit. As you can see, I can add, add scale in addition to the cut, copy and delete. I can specify my actions to go to the beginning, to the end. I can replace, I can start backward, et cetera. Then from here, let me just pop open real quickly. Thank you.
and the rest of the team. So, I'm going to show you how to use the main menu nib. I don't know if you guys can see this is getting a little bit crowded here. I should probably -- and here I've added importing plus an export view object. I've added some of my other menu items in my edit menu and also in my movie. Let me just close this down a little bit. I don't want to save anything.
Let's see if I can save anything. Now, here's the good stuff. In my declarations, they're all very straightforward. I think this is standard Cocoa stuff. You can see what we're doing as far as the class methods, the inits, some of the setters. This is probably the most commonly used of our methods. In the QT kit and down here, here are all of our IB actions.
Things get a little bit more complicated in the implementation file. This puppy is somewhat longer. As you can see here, I have a pound defined that specifies the width of my movie at 320. This is primarily to open up audio movies. And this sample code is all available for download and it's all documented block by block.
The interesting parts, I think, have to do with, and I think Kevin Calhoum will talk a little bit more about some of the issues involving sizing. And here we're opening up our document with the contents of the file. And this is partly where we're going to be doing some of our importing.
The beauty of working with the Qt kit, I think, is that it doesn't take a lot of code and it really dances for you. So I'm going to just quickly build and run this puppy. And there's my QtKit player app. As you can see, this is the default. Now, here's where it gets a little bit interesting. I can basically import and I have control.
I wonder if we get some sound. Do we have sound? We don't have sound on this machine? Okay, the next item that I want to import for you guys is my MPEG-4 file. Now here we've got... We've got some control over movie playback. Hopefully you don't have to cook with cockroaches like that.
And guess what we've added? We have the capability, which I don't have time to demo now, of additional editing functions. Add, add scale, replace and trim. We can toggle the controller. And if we want we can even clone it. There we are. Okay, things get pretty hot. We can even import JPEGs, still images. And my favorite import item, being a guy who does documentation, I decided to actually import a PDF of the documentation, which for you guys, it has a scroller down here, for if you guys can read it 30 frames a second, there you are. Okay. Happy cooking.
So the document is available that you just saw now. Since you read it so quickly, you don't need to pick it up off of your seat. But for others at the conference, you might point out to them that the QuickTime Kit Reference for Objective-C and the QuickTime Kit Programming Guide are available.
Hi, I'm Kevin Calhoun. I'm still a software engineer at Apple Computer. And I'm going to talk to you about some more advanced scenarios once you get involved programming with the QT kit. You are going to have needs that go beyond the things that you can do in a morning or an afternoon. You might have to work into the evening. These are the nighttime topics. Let me go through them one at a time for you.
As Tom mentioned, there will be some code that's necessary if you want when your Windows nib is loaded, if you want to size a view or size the entire window to fit the natural size of a movie. But we've made this easy for you. It's possible by means of one of the methods that Tim mentioned earlier, the QtMovie attribute method, to find out what the natural size of the movie is.
Then you can use that size to set the size of your view or your window accordingly. You can check whether the movie is displaying the movie controller and add in the size of the movie controller if it is. and that code, in fact code that looks exactly like this, is in Tom's sample application which we have distributed to you. So you can see it in action.
Tom's application, you call that the QtKit player, is capable of opening any of the media formats that QuickTime is capable of opening. And it does this merely by calling the method QtMovie, movie with file. That's all you have to do. And you can open MPEG-4, all the still image formats that QuickTime supports, AVI, a whole range of formats, even QuickTime movie files.
But you might want to tell NSPanel or NSOpenPanel when you bring it up that you want it actually to make all of those different file types selectable. There are two ways to do that. This is one of them here. You can use the class method on Qt movie, canInitWithFile, in order to determine whether a file should be selectable in NSOpenPanel. You do it just like this. You set yourself as a delegate for the panel and you handle the method "panel should show file name" and you can respond, "Should I show this file?" by calling canInitWithFile.
The other thing that you can do is you can actually get from Qt movie, there's a class method that will return an array of all of the file types that QuickTime can open if that's what you need to do. It's really a tradeoff. If you have a small number of files, you might want to pass them for a filter like this. If you have a wide range of file types, it might be more efficient for you actually to get that whole array.
Okay, other topics. We showed you opening movies from files. We mentioned that you can open movies from URLs. Well, what happens if you have media data stored in an instance of NSData? I've got NSData sitting around and I've got AVI in it or I've got MPEG-4 in it. I want to make a Qt movie out of that. Well, that's very, very easy. There's a class method on Qt movie, movie with data, but I wanted to show you just a little under the hood what that method actually does.
It initializes, well, it creates an instance of Qt data reference that essentially refers to your NSData as the source of the media that the movie will be able to play and manipulate. When you do this, it's very handy if you give QuickTime a clue about the format of the data in your instance of NSData. There are two forms of clue that we're able to read. One is a file name with a path extension.
If it ends in .mov or .mov, that's a good clue about the format of the data that's in the NSData. Or you can give us a MIME type, and that will help us determine how to import that data in your NSData. Then you can manipulate media data in instances of NSData using the very same methods that you saw demonstrated in use with files.
Okay, that's media data coming into the kit. What about going out? You have a lot of options for storing your movies in files and for re-encoding your movies into other forms of media. Option one, you can simply write your movie out to a QuickTime movie file. A file which only stores a reference to the media data which is stored externally. That's easily accomplished via the Qt Movie instance method, write to file with attributes.
The second option is perhaps you want to save your movie after you've performed all the manipulations on it that you want to perform out to a QuickTime movie file, but you want to store a complete copy of all the media that that movie requires. That's easily accomplished by means of the Qt movie method write to file with attributes.
I've achieved a theme for my talk. I'm satisfied. I can move on. But in this case, you have to put in that NSDictionary that you pass for with attributes some information that tells the Qt kit that you want to flatten. You want to copy all the media data to the output movie file. So that's what this code accomplishes.
Of course, if what you want to do is to store your model by means of NS Archiver, you can use that with Qt Movie instances as well. You can archive the movie as part of your whole object hierarchy. Finally, the last option is you can just get in an instance of NSData the serialized, freeze-dried form of a QuickTime movie using the method movie format representation. Once you have that, you can store it anywhere you like. In instance of NSData, which you can write to a file or do whatever you need to do with it.
[Transcript missing]
We have a left-handed demo machine today. And I wrote a very simple application that really does one thing only. It manages a list of export settings. and it saves them to a P-list of exactly the form that I mentioned in that code snippet here. This is a very simple Cocoa app.
All that it does is show you an array of export settings such as high quality or digital video. And for each of these presets that I want to use in my application, I can edit those export presets. Let's see, I want high quality to use the video compressor. Oh, let's see, what do I want to use? What do you want to use, Michael? Pixlet.
And I want that to be high quality. And I like 30 frames per second. And I want my sound to be stored as Apple Lossless at 48 kilohertz, because I know that's the audio format that I'm going to be working with. And I'm not interested in preparing for internet streaming because I'm just using this in my production pipeline. But if I'm delivering to CD-ROM, perhaps I want a different set of settings.
I may want to encode my video to MPEG-4 with medium quality, and I want my audio in this particular case to go to MPEG-4 audio. AAC. Looks good. And so all I'm doing in this application is editing and saving these presets. I set my high quality to be Apple Pixlet video and Apple lossless audio, and I set my CD-ROM preset to be MPEG-4 video and MPEG-4 audio. Now I can save This collection of presets to a document. I'm going to say these are my export settings and I'm going to store them out on the desktop.
And what I actually save in this application is a plist. And inside of that plist, which has the file type, if only you could see the file type, .export settings. It's a simple plist that contains those export settings that I can load in my application later on and apply to an export operation. This is sample code that we'll distribute to you.
If you want to implement something for example like iMovie. If I can come back over to slides please. If you have something like iMovie that has a panel that says export to Web, export to CD-ROM, this is exactly how you can implement that in your own applications. Finally, my last scenario of interest. When you're dealing with media, the interesting thing about media is that it can come from any places and have a variety of characteristics.
One characteristic is that it can be slow. It can be coming from remotely over a network or it can be a media format that QuickTime supports that might take us a while to scan in order to apply all these great features for it. For example, if it's primarily a streaming application, it can be a very slow-paced application.
If it's a streaming application, it can be a very slow-paced application. If it's a streaming format but you want to do editing on it, QuickTime might have to do a little bit of work to prepare it for that. What you need to do in your applications is to check the load state of Qt movies to determine whether or not they're ready for the operation that you want to perform. Check to see if the load state is complete before you perform editing or saving operations.
We're making this easy for you by giving you the movie attribute, the Qt movie load state that you can check for this. Our own operations, for example, are going to be a little bit more complicated. For example, if you call write to file with attributes to do export, we'll do the checking for you, but it's something to be aware of.
Those are my higher-level scenarios of interests. I'm going to turn the stage over to Adrian Baerlacher who's going to show you some of the cool things that he built. I'm not sure if he did it in the middle of the night or when, but he'll tell you. So can we switch to the demo machine, please? I'm going to show a couple of very simple demos using QtKit in Tiger.
So the first demo I have is a movie screensaver. So Tiger OS X has a screensaver framework for writing your own screensavers. And you basically just return a screensaver view. So in this case, we want to use a Qt movie view. So programmatically, we can create a Qt movie view and add it as a subview to our screensaver view.
And in this case, we set some attributes of the view, too, to hide the controller and preserve the aspect ratio. So this is only about 200 lines of code or so. Most of this actually involves setting up a configuration sheet in this case. The only other thing I wanted to show here was the, oh yeah, so we also, we observe a notification.
There's about 16 different notifications on Qt movie. And in this case, we observed the Qt movie did end notification. So that we can know when the movie finishes and go on to the next one. So most of these notifications are useful if you want to customize your user interface.
So as you see here, we have a little preview like other screensavers. And this is just picking up movies from the movies folder. And we can select which ones we want to put in here and loop them or mute them. And we can, of course, test. This would go on to the next movie once this one would finish. So it's a really simple example. The other example I have here is of a movie plug-in.
New in Safari, sorry, in Tiger, WebKit has exposed the Cocoa plugin API. And it's actually very easy to write your own plugins for WebKit. And so there's a method you provide, a class method plugin view with arguments. And we get a dictionary. This is just a dictionary of the attributes you get from the embed tag in HTML. And so I use those to initialize our Qt movie view subclass plugin movie view. And also create the movie and set that on the view. And so our subclass in this case, Also, so this is the plugin.
So in this case, we return self, the plugin movie view itself for the object for the WebScript object. So it's also very easy to add JavaScript support. And you just need to implement these two methods, isSelectorExcluded from WebScript and WebScriptNameForSelector. And this is just mapping the Cocoa selectors to the JavaScript function names themselves.
And you can see I have like play, stop, stepping, and go to end, and full screen. And most of these just map to Qt movie view, so I can just call super for these, except for full screen. But it's actually very easy to do full screen in Cocoa. I mean, we can just create a window, set the level to around screensaver level, set the background color, and add our Qt movie view to the screen. And we can also do a little bit of a window content view. So let's just run this.
So, not the greatest UI, but all of these buttons, these are all JavaScript on the plugin. They're coming for me. and we can step and I'm sure you can think of much more interesting things to do. So these are just a couple of very simple examples of what you can do using QtKit. I'm sure you guys can come up with much more interesting things. Thanks.
We're here. Well, you've seen a few of the things we've done recently with the Cocoa classes and QuickTime. You've been to some of the other QuickTime sessions, I hope, and if not, a lot of new exciting technology is in this next version of QuickTime. And the Cocoa developers that embrace the kit, the QuickTime kit, will get a lot of these technologies for free.
We're going to continue to develop the classes going forward, and there's a lot of functionality now that's in the kit today. So adopt them, put them in your app, and we'll do the hard work and the heavy lifting for you. You have the rest of the QuickTime team behind you. Okay, thanks for coming. That's our show. Oh, wait. One more thing. There is one man that is more responsible for what we've accomplished here.
The instigator, I guess. The man behind the throne. And also our number one QA person, because from early days, he was encouraging the QuickTime team and Apple to get behind the Cocoa effort and has adopted the kit from early on and helped with the design and guideline. So we're very proud to have him here, and you're in for a treat. It's Dr. Michael Johnson of Pixar. Let's bring him up.
Thank you, Ian. That was way too nice. Now I owe him money again. Well, yeah, so just to start off, I'm in a group called MPG. Every year I come, I'm in a different group, so eventually they're going to get rid of me, but they haven't yet. So people were asking me what MPG was. It's actually the Moving Pictures group, but, you know, the various jokes are your mileage may vary. We move the pictures so you don't have to.
There's no experts here, or the expert is silent. And other people at Pixar think of us as the media pipeline group, and really we're the people who are responsible for a chunk of, in the Studio Tools group, the apps, technology, and workflow for kind of what I think of as film development.
And that's really... We're a big kind of development at sort of trying to come up with the movie, the story department, the editorial department, the layout departments. And these are the groups that really deal with the film as a large-scale entity. And a lot of the other groups at Pixar and the production pipeline are dealing with a shot or a model.
And so we actually deal with sort of larger chunks. And so one app that some of you may have seen that we wrote back about three years ago is this thing called Pitch Doctor, which we use in the story department. And another one, which some of you have also seen, is this thing we call Review Sketch, which lets our directors actually draw on top of any of the footage that they're seeing in the screening rooms. And for the last year or so, we've been working on this thing we were calling the, or still are calling, the Film Online Kit. And it's a... It really would not have been possible without this effort by all these amazing engineers in the QuickTime group.
And it was something that I wanted to do because a couple years ago, my view of QuickTime was QuickTime, it's too big, it's hard, it's crufty, and it's fragile in the sense that I had to know to call this and then that and then have this thing initialized or whatever. And, you know, QuickTime's APIs... They make me tired.
And if you're a Cocoa programmer, and actually that's... So let's take a little survey here. How many of you would consider yourself Cocoa programmers who want to learn something about QuickTime today? Interesting. How many of you would consider yourselves, you know, kind of QuickTime people or sort of old school Carbon people and you're trying to learn more about Cocoa this time? Okay.
Yeah, it's about the mix I figured. So, but see, that's the thing. It's like for those of you, you know, the second group there, I really, really, really, really want what QuickTime can do for me. Like, you know, I don't want to do this stuff myself. And, you know, because my group at Pixar, you know, we're a pretty small group, relatively speaking, and we're all about leverage.
[Transcript missing]
Some other things to think about, and I'm going to give you a bunch of demos here, but I want to kind of put a bunch of ideas in your head when you get your hands on this stuff.
One of the cool ones is we worked with the Final Cut folks to come up with, I mean, they did all the heavy lifting. We gave them one good idea on this XMAML format. I've got the URL here. I went and checked that last night to make sure that was the live link there.
And it's a great file format. And what's cool about this is, especially if you're like me and you're building things on top of the QuickTime kit, and QuickTime is a great file format, don't get me wrong, but there's a lot of times you're going to want stuff to basically be editable somewhere else, especially if you're like me and you own a teeny part of a very large production pipeline and you need to have things flow around there. This XMAML format is really great for that.
And in our kit, we actually support, we can read and write it. And so that means you can sort of put these things together. And then you can save them out and just double click, open them up in Final Cut, and it just works. Another thing that I've been sort of thinking about as I've been here, I mean, the command line apps is a big thing also for us.
And what's cool about the kit is, so again, I've been trying to learn QuickTime for years, okay, failing miserably for the most part, until this stuff came along. And one of the things that sort of always comes up is people wanting to make reference movies, right? You've got like these five movies and you'd like to make a movie. Here's my movies with movies theme again.
But, you know, and I guess there's this guy, Peter Hottie, and he wrote this thing a million years ago. And people all go and get this. And, oh, it's over here. Oh, it runs in Classic. And, you know, there's some little thing for doing this stuff. And I'm sure all the QuickTime gurus are going, well, no, Michael, you just do this. But as far as I could ever tell, you know, it was just sort of black magic. And you can write this in like three lines now with the kit.
That's just so killer. You know, you can basically open up a movie, do, you know, insert movie of movie into that movie as you iterate over your movie. And then save the thing out again. And now, you know, you can even transcode it to a different codec if you want.
Amazing. And then also I was just thinking when I went to that Automator talk the other day about the fact that, you know, if you think about these things as little command line apps, you can imagine doing all sorts of really neat things with QuickTime movies. So anyway, the other thing that you may want to do is you may want to put whatever stuff you do on the kit on an IB palette. And that's what we did. So we have this idea of what we call a sequence provider.
And a sequence provider is basically a model object that is holding on to, it's basically fronting for one of these sequences. It's basically providing that thing for you through a model controller layer. And we have a set of formal protocols that these sequence providers conform to. So there is the notion of an FOL sequence providing. There's an FOL mutable sequence providing. An FOL mutable movie sequence providing. We're way too. We're way too.
We're way too protocol-y. And so we've actually implemented this for two things. One of them is actually a very lightweight thing. You know, think of like iTunes, except think of it for movies. And so you'd like to basically have huge lists of movies, big cut lists of movies. But you really don't need to play them.
You know, you're really just kind of organizing them. It would be like bringing up iTunes where you're getting ready for a party and you know all this music. You don't need to actually play it. You just kind of want to rearrange it and put it in a particular order.
The next one is an actual hardcore editable, playable. Movie sequence. Something where you can hit space bar and it's just going to play for you. And so we implemented these two things as sort of objects on the palette there. So with that, let me go to bring up IB.
Everybody has to arrange their little IB world differently. Myself included. Hey, yeah, see? You're on right, aren't I? So, let's just start off with a simple thing. Oh, document opening error occurred. Oh, that's good. We should have rebooted this machine. All right, we'll make a new one. See, I tried all my stuff on Panther and then they put me on a tiger machine.
So the basic idea here is, here's our little palette here. We have a whole bunch of different objects, a bunch of which you're not going to get to see today. Sorry. So the first thing you want to do is you want to actually drag out this little object that has a bunch of movies in it.
And because we are very firm believers in the sort of iterate really quick kind of thing, we actually have, I can go and I can add and delete movies to this thing here, which I will later on this. But it comes up and it starts up having just a bunch of movies, a bunch of little test movies sort of built in there to provide out. So the first thing you want to do is pretty much what everybody else has been doing here, which is you drag out a little movie view.
And in my case, I actually wire it up to a sequence provider. So now if I go into test interface mode, I actually go and build up a little sequence of those movies there. And so I just have this simple little movie that's there. Now, that's not super interesting. It's sort of what the other guys were doing.
And I'm supposed to be the sexy demo, so I have to do something better than that. So one of the things that is really, really neat about this. And the thing that they got really right is the fact that this is very, and again, happy that most of you raise your hands on the Cocoa side of the fence there.
Is that this is, you know, the QuickTime kit makes it very, very easy to make very MVC kinds of things. And so, you know, here we have a little table, which is representing the movie. And as we're playing this thing here, you know, it's sort of showing up that stuff there.
And we can do all this. And we can do all this. I can do all the sorts of things you would expect. I can drag and drop these things around. Now, what's going on here? I'm editing a movie. Okay? I'm editing a movie of movies here. And it starts to get really interesting of where it's actually just updating this stuff. So we'll put some more.
and David I don't know why those guys don't want to open. That's weird. Anyway, will go and instead of having just a table view, we can use an outline view. And so you can notice now that when we get with some of these things, there were little disclosure triangles on them. And that's because these themselves are movies of movies of movies.
So in our little test thing that we've got there, we actually have it set up so that it's not only just sort of one level of hierarchy, but it's two. And all the sort of stuff that you would expect to have work works, you know, you can sort of drag between them and stuff like that.
And we're doing, you know, we're doing some heavy lifting there, but the fundamental QuickTime activity that's going on there is that little function that I put up there, which is basically all I'm doing is I'm inserting an element. I've got sort of a companion one of that, which is basically delete element from segment.
And these guys really did it right. It really sort of works the way you would expect it to work. And again, we've got with the kit that we've been working on, we have a whole sort of raft of these UI elements. So let's just go and let's see if we go and we say let's put that in a tab view.
What did I put in a tab view? Something's been put in a tab view. So let's put this guy in a tab view there and then we can actually go and we have another view which is a tableau view. And so if we wire that guy up to, sorry, I'm dragging the scroll view. And this guy will go and let's actually also drag out a little slider. So we'll do this sort of iPhoto kind of thing.
So we can see our movie that we have here as both looking at it that way or this way. And again, sort of all the same kinds of things. We can go and move these things around and we can go and... I should have made it continuous. That's why you want to use IB. So now when you go in there you can try that sort of stuff. I really want to sort of take this moment here, since you're Cocoa folks here, to evangelize a few things.
I came from the old Next Step world. That's sort of how I got to Cocoa. And one thing that used to happen a lot more in the Next Step world than it seems to be happening in the Cocoa world is people would put things on palettes. And it makes me sad that I don't see more IB palettes.
And I pushed really hard on the QuickTime kit guys to get sort of all their ducks in a row on there. So in terms of, you know, all the encoding methods and things like that are in there so that you can actually go and put all this stuff in there, put it in a nib. And there's a certain rigor that happens when you actually go to the trouble of putting things on an IB palette. And there's a certain cost up front in terms of actually making it so that all your objects know how to sort of work with it.
And that they're using key coding, you know, correctly. And there's some work you have to do there. But it's really worth it because there's nothing like, you know, taking down another app to know when you've got bugs in your code. And the cool thing about IB is, you know, I'm, you know, in and out of test interface mode there. If I'm not releasing everything correctly or I'm doing some bad trouncing on things there, I'm going to pay for it really quickly. And I much prefer to sort of take the pain of that kind of stuff not quite completely up front.
But, you know, people don't sort of go and finish things out well enough, I think. And it kind of makes me sad. So I'm hoping people will see, you know, this thing as a kind of a non-trivial example that was basically done by, there's like, you know, four people that contributed to the code on this thing here.
So it's not a huge, it wasn't a huge, huge effort. But it is something that you want. Now, take out, again, sort of there's the obvious thing then that if you're going to really start trying to do production apps with this stuff, the one thing that I think, you know, we all know that we need is a timeline. And so we have a little timeline view that we can drag out here. And eventually... Start up there. So here we have a little timeline.
And same sort of stuff happens. You know, you've got selection. You can see it happening between them there. We've got interactive. We can sort of change the in and out points on there and then indicate those things. And here's sort of a neat thing. So remember, this is a movie of movies inside our movie, right? So and remember that that little movie had, if we look, it had, it was made up of three and four.
But it's a movie and it has in and out points. So theoretically, we could actually change the in points of that thing and move it in far enough that it's sort of representative first frame is no longer three but four. And so that's sort of just proving that I sort of have no, you know, I'm not lying here. Another thing that you could do on this kind of stuff is you can use sort of non-trivial movies. So let's actually get into that. I'm going to get rid of my trivial movies and show you some non-trivial ones.
So now unfortunately, when I grabbed these movies, I grabbed them off the disc farm and we made them from there. And so these movies have no sound, but they are real movies nonetheless. And so this is some stuff from a little movie we're working on this year called The Incredibles. And so this was from the trailer. And so this is pretty interesting because these are the real... Are we... We're in a bad place right now. Let me just check this again, sorry.
I'll be for a second here and do this again because things say they're being freed in the middle there. You probably want to start again. Okay, so if we drag out a little movie view here and we drag out a timeline and then we pull out a sequence provider. And then we'll go and we'll edit that sequence provider. And then we'll go add those movies in again.
And so the, you know, what I'm hoping that you're getting from this is the fact that you can use this kit to do real things. You know, these guys have done, you know, there's still, I think, I think there's still lots of, there's lots of QuickTime left that's not really exposed in the kit right now.
But I think there is an enormous amount of work that these folks have done. So here's our little sequence here. And what's fun with this is that, you know, you can even actually edit this thing, you know, while it's playing. This is what I mean by it's magic.
I didn't do anything to get that. You know what I mean? Like, I'm just, like, editing the movies of movies there, and these QuickTime folks are just making that all work. And I don't really know, you know, sort of what they're doing. And I don't have to know.
That's the point of doing stuff with Cocoa, right? Leverage. It's all about leverage and trying to get, and trying to, and to leverage what these folks are doing so you can get back and do sort of the real work that you want to do. Is that the time for talk or do we need to leave time for questions? for talk. Okay, good. Okay, I'll wrap this up here.
So that's, oh, it's kind of dark up there. That's too bad. This is actually a full film res pixelate playing back there. And we can also, there's other things in the kit that I sort of haven't talked about, but I can do things, like we have this notion of markers that you can drop down and you can drop markers on things and snap them to things. Or we can put a, I can put like a marker here and then I can extend that thing out. And then I can do things like drawing on top of it there.
And then I can actually go and just play. And like the drawing there is actually using a child window. So there's actually, this is again, sort of the magic of Cocoa, right? Is that I've got the child window stuff over here. So I did that drawing in a separate window that's coming in there.
The Qt movie view has no knowledge of that stuff at all. The GPU is doing the compositing there. So I didn't have to like, you know, draw some sketch track inside of QuickTime and then hope that QuickTime, you know, it was a fast path in QuickTime to sort of composite that stuff together.
You know, I can sort of have that little drawing up there. And this is the kind of stuff that we do all the time and have it not cost me anything from QuickTime. And what's so great about this from, again, from a Cocoa person's perspective is that QuickTime's finally sort of, you know, arrived in, you know, to my party.
Where, you know, they were having a great party over there by themselves. But now like I get to use them and I get to make them plug and play with all the things, you know, interface builder and child Windows stuff and just being able to build a framework and to be able to sort of move things around really easily.