WWDC2000 Session 305
Transcript
Kind: captions
Language: en
please welcome calm Doughty thank you
good morning this session is entitled
quicktime the road to mac OS 10 which
contrary to what you might be thinking
is not san carlos street out there what
are we going to be talking about this
morning we're going to be talking about
quicktime on the OS OS 10 platform and
things that you need to know about
quicktime on the OS 10 platform for your
application we're also going to cover
some new things that are true for all
platforms including the mac OS 10
platform that are different from the
last time we got together a year ago
we're going to talk about extending the
quicktime platform this is on the
existing Mac platform on Windows and of
course on Mac OS 10 the important thing
to know about quicktime on mac OS 10 is
the quicktime is a first class citizen
of mac OS 10 most of the things that
you've come to know and love about
quicktime are the same they haven't
really changed a few things are gone a
few things have been added and there's
some new opportunities for you the
developer you can call quicktime from
either the carbon or cocoa api set you
can also call quicktime from java here's
the classic a picture of mac OS 10 you
can see the quicktime is layered down
with all of the other graphical goodies
that are on Mac OS 10 what's the same
the same api's are available on Mac OS
10 on windows on mac OS 9 mac OS 8 mac
OS 7 we finally this year cut off Mac OS
6 so those of you that still have
applications that are targeted for the
607 platform sorry that that's that's
the end for you I think most people have
read by now
all of the major codex has you come to
know and love are there on quicktime pro
rack oh is 10 that includes streaming BR
the wired actions you just heard about
the URL data handlers in fact there may
be more there than you are used to if
you're used to using QuickTime on other
platforms we'll get to that in just a
moment there are a few things we had to
take away not very much so in fact we
had a difficult time coming up with what
exactly we did remove for mac OS 10 the
the major one from an api standpoint is
the various get file preview calls such
as standard gets all preview or custom
gif file preview these are no longer
necessary nav services provides the
preview services for opening and closing
documents on Mac OS 10 so there's no
need for additional work that we were
going to be doing simply use now
services in your application and you'll
be fine some codecs that were related to
legacy application see types of
technology that are no longer available
on Mac OS 10 those codecs also don't
need to be there there's some excellent
new opportunities for you if you're new
to quicktime or you're new to the mac OS
10 platform some of the new features
that we've been talking about in
quicktime are available first on the mac
OS 10 platform in fact they're in the PR
for CD that you got here at the
conference flash for and cubic dr are
good examples of this those technologies
are there for you to play with and enjoy
right now they'll be available for you
to play play with and enjoy later this
summer for the other platforms
one of the important things that has
been asked earlier in the conference and
unfortunately didn't get a chance to
grab the carbon guys before they were
doing their presentation is the issue of
the event run loop or the timer event
and idling of movies within your
application so I'm going to do a little
demo here and then we're going to come
back and talk about idling so if I'd
have a demo to up oh we see the demo to
have gone to sleep sync the audio is
back now so we should be able to get it
back up all right so here we are we're
running the quicktime player application
is if you haven't seen this enough so
far in the conference open up the movie
here
start playing this now you can see if
the movie continues to play even when
other things are going on the computer
that's because of the various
multitasking services that are available
in Mac OS 10 it's a little difficult to
see probably on the projector but the
movie is actually transparently being
displayed through the menu as I've got
the menu bar down here kind of a nice
little feature being composited live one
of the things that wasn't pointed out
though and that if you'd seen the demo
at the mountain instructs movie again
we've seen this demo at macworld you
wouldn't have noticed because it wasn't
true is that the equalizer bars in the
lower right-hand corner of the movie
continue to move this is idling and user
interaction of the application that's
not specific to quicktime in addition
the play bar at the bottom of the movie
and the time of where we are in the
movie on the left hand side continued to
advance as the movie is played even
though the mouse is down stop that there
and we'll go back to slides why is this
important step back here this is
important because this is a section of
the application that could not possibly
be handled by quick time itself these
are user interface idling services that
are unique to this application so it's
applications responsibility to service
the idling that concludes the idling of
the movie and the Eiling of its own user
interface in specific if you the
application are doing the movie idling
it's important for you to be involved
because of the following reason the
idling calls in QuickTime have an
implied API around them which is that
the origin of the window effects where
the movie is displayed within your
application if we idle the movies on
your behalf we would not know where you
may have set focus within your window
those of you who are used to using power
plant or other such frameworks realize
that you focus on various
use within your super view of the window
that process involves setting the origin
of the window as that focus would be
moving from button to button or sub you
to sub you within your applications
window if we suddenly came along and
idled one of the movies for you you'd
find the imovie kids movie suddenly
playing on top of your pause button
rather than where in the window it was
supposed to go because of this and
because of the fact that your
application also has other movie related
idle tasks to do we do not i owe the
movies on your behalf there was a demo
let's talk about some changes inside
your application on the road to OS 10
the quicktime team also went down that
road we had a lot of work to do to get
quicktime performing well on OS 10 and
running the way it's supposed to most of
these things we'd already done for many
of our components some of them we hadn't
done it all for any of our components so
we had to go through these steps
ourselves if you have been to any of the
carbon sessions you've probably heard
some of these things before so I'm not
going to belabor them over and over
again there are two that are
particularly important I think and so
I'm going to call them out first one is
you're making a lot of major changes to
your application potentially and the
process of carbonizing it you're going
to be reek wolluf eyeing it and re
qualifying it on a new OS now is a
really good time to remove some of the
older legacy code that you might have
hanging around a good example of this is
applications or codex to check for the
presence of color quick-draw even though
they're compiled for powerpc the PowerPC
has always had color quick-draw that
check is unnecessary it's flowing down
the loading of the application slowing
down the loading of the codec and adding
additional dependencies on parts of the
system that you really don't need to be
worrying about so take a pause look at
your app that file that you haven't
touched since 1989 you might want to
look at once or twice another really
good trick that we discovered inside the
QuickTime team
you want to be compiling your
application with a maximum amount of
type check type checking turned on
because grass courts windows dialogue
pointers are no longer freely castable
back and forth if you're not performing
casting yourself the compiler will catch
this type of behavior and point it out
to you very quickly you'll be able to
correct it move on make the appropriate
carbon calls and your application will
be sailing along however every once in a
while somebody either through habit or
knowledge that a lack of knowledge that
this is not necessary will be performing
additional kaif between one type and
another it's a good idea to search your
application for grass pointers window
pointers and dialogue pointers the
searches i have here you'll notice they
don't have a beginning parenthesis on
them that's because if you search for
grass pointer close parenthesis you'll
also catch all the caps to type color
rapport as well anytime you see one of
these casts you should examine that code
try to figure out why it's being done
and corrected if necessary this is
especially important if you're using
carbon on OS 9 as part of your bring up
strategy for OS 10 these types of
compiler errors or casting errors will
not be caught by running on OS 9 where
graph pointers window pointers and
dialogue pointers may still be freely
castable back and forth but when you try
to bring your application up on OS 10
they'll crash very hard much easier to
fix this by gripping inside of your
development system than playing with gdb
on the other system here is a very
important point Mac OS 10 is a
pre-emptive multitasking operating
system if you have an application that
has interrupt completion routines
associated with those interrupts you
need to be aware that interrupts can be
running in a separate thread and these
threads can preempt one another the
specific case that you would never see
on the classic Macintosh operating
system is that while you are servicing
and interrupt in one of your callback
routines your main thread might start
running again
this can happen on Mac OS 10 and will
happen on Mac OS 10 if your code is not
ready to deal with this if you're not
appropriately putting you texts
semaphores or other types of OS level
protection around global variables that
you're accessing both from your main
thread and your interrupt completion
routine you're going to have a very
difficult time tracking down these
problems when you're running on Mac OS
10 these same issues arrived on Windows
and their problems that we've been
having to deal with inside a quick time
for quite some time now so when we were
bringing our code up on Mac OS 10 we
needed to make sure that we were doing
all the same level of protection on Mac
OS 10 as we do on windows as a matter of
fact just two days ago we track down a
bug where we'd missed one so with that
I'd like to bring out Greg Chapman have
them come and talk to you about new
features that are available on all the
platforms in the last year in quick time
Greg
thank you and we talking about some of
the new things that we've added to click
time since the last time we had a
developer's conference three things in
particular variable bitrate audio is
something that we've been asked for a
lot we finally added that to support the
variable bitrate mp3 files of course you
could actually open files and URLs
before the but there's some new twists
that need reviewing Kevin Calhoun talked
about this a little bit in the streaming
session yesterday but we'll go through
that in a little bit more detail the
coolest thing about all these new
features and variable bitrate audio is
just an example is the existing apps
will pick up the support for free you
don't have to rub your app there are a
couple of exceptions in this case the
main exception is if you call the sound
manager directly to play audio then you
need to know a few things I'm going to
give you some of the highlights point
you at the real documentation we've got
lots of documentation on these new
features and you'll be ready to go
there's a new constant variable
compression it's actually been in the
sound eh header for a long time that has
never been supported it's right next to
fix compression we support it now it's
great several structure has been
extended if you don't know what those
structures are you don't need to know
that they've been extended and will its
take care of it for you the the biggest
problem that you're going to have to
deal with in your code is if you call
the sound converter api's and you want
to be able to convert to or from vbr
audio there's a new API it's well
documented on our website the old sound
converterconvert buffer API had a lot of
assumptions about relationships between
input and output buffers that of course
gets completely blown away by vbr audio
sound comforter fill buffer is much more
flexible you can use it for vbr and for
CBR audio we recommend that you do that
you pass it a callback routine that it
will call every time it needs more
source data
and that callback will get called a
completely variable number of times per
output buffer there's a couple of flags
a little return to let you know what its
status is if it couldn't fill its output
buffer or if it has data left over your
code can deal with that pretty simply
the quick guide for one PDF is going to
be referenced several times in the
slides this has a whole pile of
information about some of these new
features it's easy to find up on our
website 64-bit file offset support has
been in quick time for a while we
supported it on windows because they had
a file system that would support these
large files with mac OS 9 and quicktime
41 64-bit file offset support really
huge file is supported on all of our
platforms again existing apps will pick
this up with no change no problem at all
the two exceptions one exception is if
your app creates or modifies movies then
you need to be able to read and write
these new types of movie atoms we're
real careful not to use the new movie
Adams unless the file actually is bigger
than two gigs so that if the file is a
small movie files your old app will be
able to read it without having to rev
the other exception is if you write a
component that provides file access in
this case not only do you need to call
the new API is in the toolbox to deal
with the file but you actually have to
implement some new component calls in
your component to return various 64-bit
values and it's all pretty
straightforward the details are
documented really thoroughly on the
website particular there's a nice load
dispatch about this particular feature
it's been up there a while since we've
been supporting this for a while on
Windows the ice floes are really useful
this is dispatch 22 they're kind of hard
to find your best bet is to search for
ice floe just go to the main Apple page
and search for ice floe and you'll find
it if you can't remember how to spell FL
0 e just search for ice there's
one major hit that some guys journal
from Antarctica and then after that it's
all ice floe knows there's a new
document that's coming out this week I
believe it's already posted on the
website inside QuickTime the QuickTime
file format this is way more detailed
and you're going to need unless you're
one of those lucky people that gets to
parse movie files by hand a bite at a
time without the use of QuickTime and
then you'll really want to read that
manual opening files and URLs doesn't
sound very exciting but there are three
cool things I want to tell you about and
apparently what I'm really cool data
reps are an abstraction of various types
of data sources and Kevin talked about
this yesterday for using to get to urls
new movie from data wrap can actually
open files as well if you use new movie
from file that's fine but you can set up
a data rep that points at a file you can
set up a data reference points out a
handle you can set up date arrested
point at lots of things this is actually
an extensible part of QuickTime you
could write a component that extends
QuickTime and adds a new type of data
wrap and QuickTime would then be able to
read data from your source new movie
from data ref can open any piece of
media the QuickTime understands get
graphics importer for data rep is
specific for still images you can open
still images with new movie from data
rep but you'll get a movie with one
frame in it which may be useful but
probably isn't as I said files or data
refs a data rep is just a handle and it
contains some piece of information that
points you at a data source in this case
the handle just contains an alias and
then you pass in two new movie room data
reps as a second parameter that you tell
it what type of data ref it is pretty
straightforward the next slide is going
to take that gold code and change it to
open a URL instead of a file but the
call to new moon from data rep is
identical there you go URLs of C string
don't forget that null termination put
it in a handle
pass it off the new a new movie from
data ref as Kevin said yesterday the web
can be slow async movie loading is new
and quick time for one but it's just an
extension of what we were already doing
we already have the concept of fast
start where the movie can start playing
before all the media is down but in fast
start the entire movie header does need
to be downloaded before you can play so
a new movie from data wrap doesn't
return until the entire movie Hatter has
been downloaded and in some cases over
slow connections that can be pretty slow
what you can do is use the new movie a
shinkoukei flag which will take fast
start one step further new movie from
data rep will return immediately with
basically an empty movie which you then
can't play the return movie isn't all
there and you have to continue tasking
the movie if you're using a movie
controller which we recommend you
continue passing events for the movie
controller because this async opening of
the movie doesn't happen in interrupt
time it happens at task time in you know
as you task it more the movie comes down
get movie low state is the API you call
to find out when your movie is playable
there's several states it's loading
means that the header isn't all the way
down yet so please don't start playing
yet which playable complete actually
means that all the media is down the
fast start has finished and the whole
movie is down so now you can turn on
saving in your app or something like
that you can get an error state back and
there's another API to call to get movie
stayed or get movie error to find out
what the error is the states are on a
numeric scale you should use arithmetic
comparisons because we reserve the right
to insert new states in between but if
you say you know is less than playable
don't play it that's always going to be
good forever
now we get to the really cool thing that
mo dispute for you in a book in just a
minute you can call new movie from data
ref or get graphics importer for data
ref on any file at quicktime understand
you don't need to know anything at all
about the file format we wrote a simple
app that's so lame it doesn't even know
about graphics and quarters it just
calls new movie from data ref on
anything you drop on it sets up a moody
movie controller sets it up to play it
starts passing the movie controller and
let's see what that lame app can do over
demo one there it is we call a simple
movie player let's just drag a whole
bunch of still images onto it now these
will open his movies but that's alright
we'll get to see them anyway oh we have
a JPEG we have a BMP file for you
windows phonetics an SGI image let's see
what do we got here I can scale this
down so you can see more of it a
Photoshop file that we modified
extensively for stupid movie oh we have
a ping we have a target file oh here's a
mech paint image that's great we have a
tiff let's see what else we can do add a
bunch of audio files here this movie
player just does the same thing to all
of them here's an interesting WAV file
we found somewhere
[Music]
actually drag that off of my Windows
machine yeah here's an aiff you know
pretty standard there's a cheap midi
file we can play those two sound
designer too here's an mp3 hold your
name we've just got a whole pile of
things and moving simple movie players
doesn't do anything different for any of
these he doesn't know what these files
are he just makes this API calls
everything works let's see we had a
couple of little more movie like things
there's a flick animation here's the
interesting avi file why didn't you
learn about the room in a whole movie
okay here's here's his an animated gif
of an imac for you okay there we go
here's a DV stream straight off a camera
one seat to see red sea blue sea can
play that I hear some more interesting
things we can do here's a flash
animation an SWF file we got Mouse
rollovers you know the app doesn't know
anything from mouse with the lovers no
big deal here's an rtsp file that let's
see what's playing on BBC world this is
always a risk because you don't know
what's playing on BBC World some
horrible tragedy that happened today I
don't know
now streaming is interesting because you
come in not a cemetery just so the end
up with gray and then it there's BBC
[Music]
here's one of those really cool Matthew
movies that we've set up if anybody saw
that demo it's kind of fun it's a
calculator in a movie let's take the
tangent of that I don't know how he does
the trig functions because we don't have
wired actions for trig functions you
must be rotating sprites or something I
don't know it's insane and here is what
I feel is the key feature of QuickTime
41 something people have been asking for
for a long time because it's huge so
this app doesn't really know how to
scale very well I can scale it down by
app so you can see it this is a tiff
fact we finally support and quicktime 41
this is kind of an interesting patent if
you read this here is a free zone bed
cover with an inflatable human form and
if you could see farther down it
actually says that that's for security
reasons so you know some burglar would
actually think there's more than one of
you there i don't know there's a lot of
tiff faxes at the Patent Office you will
find we can go back to slides thank you
and with that I'd like to introduce you
to Sam bushel he actually wrote the tip
facts importer so you can thank him for
that welcome Sam thank you good morning
do you appreciate these facts I'm glad
you care Tom and Gregg has talked about
using QuickTime on various platforms I'd
like to talk about quicktime as a
platform itself quicktime is a platform
for doing stuff with media in my words
so if you have some media technology and
you bring it into quick can you gain is
rock ability with hundreds of existing
applications the way you extend
QuickTime is by writing components and
that's what I'm going to talk to you
about so first let's survey some
component types of the pretty important
if you've developed a media compression
technology which you'd like to support
within QuickTime then the way you do
that is by implementing a compressor and
decompress a component pair to implement
it now your compressed data will
automatically be stored using the
QuickTime file format all you have to
deal with is the tiny step of moving
between the sounds or video and your
compressed data if you write the
compressor then you it will appear in a
lot of standard compression dialogues
for that media type so streaming there
are two important component types at
this level there's packet Iser
components which break out some press
media data into samples into packets
that can be sent over the wire and then
there's reassemble components which
combine those packets back into the
media samples which are ready for
decompression now you don't necessarily
have to write those quicktime is able to
stream your content without you having a
custom packetized and reassembly but in
that situation you don't get any codec
specific resilience to data loss for
example if you're watching a video
stream and you lose one packet out of a
video frame then the user doesn't get to
see that entire via frame
subsequent frames until the next
keyframe that's a big loss the other
hand if you devise an RTP payload format
that can incorporate some cleverness
that's specific to your data format and
is able to recover from some packet loss
then you can implement a packet eyes
when the assembler pair to make that
work still images my favorite quick
glance models are still events a thought
on the import side is split into two
pieces graphics importers which handle
the specifics of file formats and image
decompresses which handles the specifics
of google compressed media data inside
though graphics and photos has taken off
as a platform in themselves you'll see a
lot of applications which lists the file
formats they support as these 12 plus
any other that QuickTime support by
writing a graphics importer for your
file format you'll insert yourself into
all of these applications the situation
is similar with graphics exporters
although there are fewer applications
that are interested in writing files
than there are that read them when
writing graphics exporters you have a
choice of whether you keep your
compression technology inside the
graphics exporter or whether you
packages inside a separate image
compressor if it's inside the image
compressor then that will appear in all
of the standard compression dialog it's
up to you whether that's the way you
want to go for instance we don't think
it's a sensible idea to have mac paint
appear in the static video compression
dialogues because not many people want
to have one bit seven by eleven movies
it just isn't a very popular format
people often start thinking off of
quicktime movie important ponents as
file translators start off with an XYZ
file and write out a movie file but
they're actually whole lot cooler format
is Greg demonstrated a movie important
component simply needs to be able to
pass some file and identify where the
compressed media samples in are in that
file and then create a movie header in
memory that references those samples
inside the file once you've done that
quicktime can play the movie straight
out of that original file this is called
in put in place and it's why you can
take an animated gif or an avi file and
open in the simple text or a simple up
like that writing video FX is a lot of
fun and is pretty easy we have lots of
samples I'll show you a demo of a really
cool third-party video effect in just a
moment now media handler components are
the part of QuickTime that implement
individual tracks inside a movie if you
have a time-based media technology which
doesn't fit into the existing models
that the existing track types in
QuickTime handle you can implement it in
a custom media handler an example of
that is puppet time if your company
develops hardware that can bring media
into the computer or play it back out of
the computer then you'd write one of
these components to enable QuickTime
applications to take advantage of it
particularly important one of these is
the bottom one video digitizers I should
point out for those of you who are
interested in video digitizers that
there is a birds of a feather session
tonight at 630pm i believe the room is a
one or a two but there'll be people
standing around there that look like
with some engineers and people who look
like VD Grider's whatever they look like
hopefully if you wander around in the
building and something gonna be on the
other side I don't know is there any BS
on this side of the road it shouldn't be
too hard to find some of the component
interfaces inside QuickTime involve an
awful lot of fairly dull bookkeeping
details that don't relate to every
implementation to let you focus on the
piece where you add value we've
implemented a collection of base
components which handle the most common
details for you in some cases is very
hard to get these details correct by
yourself for example the base image
decompressor
helps you handle a synchronous cued
scheduled decompression without handling
the cue yourself we look after that we
look after all of the reinsurance see
the race conditions and musics
protection for the for the Q and a bunch
of other related issues we found that we
could get rid of a lot of bugs in quick
time when we switched over a bunch of
our other in which decompressor
components to use the base codec so if
you're going to write any of these
components you please start with the
base components for these categories you
will save yourself a lot of stress and
now i'm going to demonstrate some cool
third-party things shouldn't though quit
some of these things so the first thing
that I'm going to demonstrate is a video
filter it's called video go it's from a
company called revision FX I have it
installed here this is a regional piece
of content has a little bit of audio
illness and with with quicktime player i
can choose export movie to quicktime
movie and then select a filter and you
get a preview here so it's definitely
installed but it's not real time it's
actually quite slow so I've did this
movie ahead of time so you enjoy it
[Music]
this video effect was developed by the
same people responsible for some of the
special effects from movie what dreams
may come it's a really phenomenal visual
thing to look at and so they decided to
make it available to general customers
of people using QuickTime and a few
other app for the price of thirty
dollars can go to their website and type
in your credit card number that's what
we did so okay there's a video effect
being used by a QuickTime application
you can extend quicktime that's
interesting here's another situation
here's a file format from a company
called bit jazz the file form is called
photo jazz it's a lot less compression
format for pictures it's fairly
expressive these are all the same
picture so you don't get to see much
difference between them there's a
photoshopped version a pink version and
the photo jazz version and their big
deal is there they claim to do better
compression than everyone else there's
certainly a lot smaller than the parrot
in Photoshop there exists what 20 25
percent better than the ping on this I
think so so that's pretty cool for
people who care about storing a lot of
images and taking them to supreme places
but if your business is developing a
file format or compression technology
it's a tough job if you have to go and
talk to individual application
developers just to get them to support
it these guys wrote the QuickTime
components to support this a graphics
importer on a graphic to explore der and
they have different levels of graphics
exporter that you can of writing support
that you can get by painting different
maps amounts of money but everyone gets
the viewer for free you see
so that's photo jazz running inside
picture viewer in each case is this is
just extending a quick time application
which is often the way we demonstrate
things because well they're the
applications that were familiar with but
what's rather more interesting for users
is where they're taking a third-party
application and they're having that
applications power extended by the extra
component so this is an application
called painting by someone called Howard
calm thanks to the graphics in porter he
can open the parrot there's something
else that's interesting here painting
uses quicktime video effects as filters
and so i can choose video go here and
one of the other choices defines an oil
painting is a short this is and give you
an idea why it's not really real time
for doing a video effect takes a moment
but it's a great effect so here we have
a third party application and two
different third-party components or
working together I don't believe what I
don't know but there's no sign that any
of these individual third-party vendors
had to communicate with each other in
order to establish a standard just the
involvement of QuickTime here has
enabled them to work together I think
that's neat
[Applause]
so let's talk about writing your own
components now that you've seen what the
competition can do there's an awful lot
of sample code on the quick climb
developer website which does include a
wide variety of sample components
there's sometimes a little bit buried
and you may have to try several before
you find the right one for what you're
trying to do rather than discuss these
individual samples I'm going to talk
about from the key concepts that are
absolutely important for any kind of
component that you want to develop so
first of all I'm going to talk about
component dispatches now conceptually a
component is a cohesive module of code
that works for a particular purpose like
a chief facts graphics important each
component has a single entry point known
as the dispatcher and it knows about the
functions that are implemented by that
component and it knows how to route the
calls that come in to those components
now notice that the functions on this
all have numbers next to them these
numbers are called selective negative
selectors are common to all component
types non negative ones that 0 and
positive numbers are specific to the
component type you're dealing with and
sometimes the component subtype the four
top ones you see here are component
functions that have to be implemented by
every component they're open which
allocates storage for your component and
anything else that you need clothes
which gets rid of it can do which finds
out whether a particular selector is
implemented by your component and
version for determining the difference
between for establishing the version of
your component in case someone needs to
know that so the job of the dispatcher
is to know the relationship between the
number and a function and to call the
right one of the right time it doesn't
seem like a big deal unfortunately it's
a nuisance it's easy to get wrong there
are fiddly details that are different on
different platforms we have a tool that
helps address these problems called
component dispatch helper that's what we
use internally for writing almost all of
our clip time
and it isn't perfect but it's well used
and it does generate both the dispatcher
and the can do from a single list so
they don't get out of sync it's also
faster and more robust than doing it by
hand once you've got the hang of it so
it is also demonstrated by some of the
pieces of sample code although the
thermals had also demonstrates
alternatives to using it so I'm not
going to explain how to use it in great
detail but it's very useful to be able
to understand the concept behind it
basically it works by using some macros
to generate a two-level array that
contains pointers to your functions we
use a two-level array because component
selectors are often grouped by category
and spa the sum start at zero some
started hexadecimal 1001 start
exhibition all 200 so rather than have
one big one big array that you index we
have the first one tells you which of
the second to use now if your component
doesn't implement some selectors you
still need to put empty slots tail so
that functions was later selectors go
into the right slots on the table the
component dispatch helper because of the
limitations of macros and see doesn't
protect you from that kind of stuff so
you need to be a little bit careful and
need to hex have in mind what this is
actually doing when you use it but if
you do you should probably be okay let's
also talk about the way we describe
components there's a resource called the
thng resource or the thing resource now
a little bit of history the component
manner g you was originally called the
thing manager and components were things
and component instances with thing
instances legend has it that apple's
technical writers found it too hard to
write meaningful documentation about
things and big the engineering team to
call them components instead who knows
whether that's true let's have a look at
a thing resource for a 68 k component
classic type
we have fields that have the type
subtype and manufacturer codes as for
character codes we have a flag field we
identify have resource type and ID's
that identify the code resource and some
strings and there's some other stuff in
there that I've permitted for for
clarity note note that the first bite of
the code resource is the entry point
here every time you make a component
call on a 60k components it'll jsr to
that we don't use the Colonel's field
for powerpc components instead we added
something back years ago which was an
extension called the component platform
array you can actually have a single
thing resource that describes the code
to be used on multiple platforms and the
component manager chooses the right one
when it registers that component so if
you have the component platform right
you have to be set a bit called has
multiple platforms even if there's only
one two rather poorly named constant we
admit that there's not much we can do to
change in the past now also note that
the flags have been moved down from
where they were to part of the component
platform array this means that different
component implementations different code
on different platforms can actually have
different flags which is sometimes a
useful property so in this case the code
resource is a PowerPC pest container
with a routine descriptor so the main
entry point for that pep container it's
a routine descriptor that's wrapped
around the dispatcher what about Mac OS
fan well I just moved the the diagram
across this is the same as you're seeing
on the previous slide I've just chopped
off the top did a Mac os10 there are two
linkage models there's the code fragment
manager and is also Marco the mark
object format however mecos 10 does not
support code and code resources
during the data fault somehow the CFM
the the code is in a pet container
inside the data fork and it's described
by a sea frag resource now you can have
multiple paths containers in the single
data for you so you don't have to have a
proliferation of a file but you have a
single see frag resource that describes
them all and the number that is normally
a resource ID is actually a tag that has
to match a field inside an entry inside
that extended defrag resource with Marco
there is with Marco the entry point is
identified by a symbol name and so the
symbol name is stored in a string
resource to type dll e now since the
namespace for Marco symbols is flat you
should take care to give your your entry
point a distinctive name otherwise you
might at the situation where two
different vendors both chose my
component entry point and the result of
the collision like that would be highly
unpleasant also note that there are no
routine descriptors on Mac OS 10 in both
cases here the entry point is the
dispatcher itself not wrapped
accordingly the platform type has
changed from power pc to pc native entry
point let's go over that again on Mac OS
10 the entry point is not wrapped in a
routine descriptor and the platform type
is tar PC native entry point another
thing Carbon lib components components
should only link to carbon lib on Mac OS
10 other mac OS 9 it turns out the
carbon live extension on mac OS 8 and 9
currently only provides support for
applications and some plugins not for
general components Oh some technical
reasons behind that if you want to
deliver a single file that your users
can use on each platform however you can
your thing resources would have two
component platforms in the component
platform array and one of them would be
Power PC platform with which would link
to interface lid and have a routine
descriptor and one of them would be the
one to ten which would say PowerPC
native entry point have no routine
descriptor and be in the data fork and
link to carbon blue also note that the
dll dll ii you might have guessed by the
name the mechanism movies on Marco is
the same as we use on windows so if
you're familiar with one side the other
side should be pretty easy in some
situations you need to register your
component twice for example if you want
to write a graphics importer or on movie
importer the component subtype for that
component might be interpreted as a file
type or you could set a bit that it said
it should be interpreted as it come as a
file name suffix now you probably want
people to be able to open your files if
they have one of those right but not the
other in which case you need to register
your component twice so the lookup
suppose work correctly there's a good
shorthand for doing this called a
component alias it's a slightly more
efficient than having to sing resources
that both describe the same code it
basically tells the component manager to
register a second component with the
same code as the first but with a
different subtype or different flags so
what happens when things go wrong and
you're working on these components if
your component doesn't load initially
first thing to cook ask is did it get
registered okay you could write some
code like this and run it or you could
use all the tools that I'll show you in
a moment if you've established that the
component is registered you should find
out whether it actually execute so you
could set a breakpoint in your open
routine and run some code like this the
usual things that go wrong when we are
working on components we find that
people often forget the has multiple
platforms bit partly because it says
that the poor name this like really
means this is not a 68 k component so
you need to set this bit for practically
all component you right now
if this bit isn't set that'll prevent
the component from registering now other
problems that occur where the component
gets to register but it can't even be
open basically troubleshooting Z's
involved working from the thing resource
through to your code making sure that
all the steps on the way are correctly
set up with the resource ID in the thing
resource points for the dl e string and
that that has a name that matches the
next step and so forth and that the make
the the the entry point that's in that
string is exported from the from your
library so there are a few tools which
are very useful for browsing the
components that are installed our
computer I'm going to demonstrate a
couple of these in the moment the free
one is max bug every version of Acts bug
that's you should you can use with
current versions of Mac OS 9 has a
built-in debugger command called thing
I'll show you that in the sec there are
also a couple of nice shower tools with
graphical interfaces there's one that's
new today I think it's certainly knew
this week called thing detective there's
a free sub version called things of
reporter from unthinkable research
there's also i think thinks things from
tactics software before i show you those
tools i'd like to mention another thing
that's very useful when you're actually
working on a component it's very
annoying if you have to restart every
time you make a change in the code and
recompile and rebuild instead if you
drag your component onto the small
application called reinstall ER I'll
reinstall of three at the moment it will
unregister the previous version of your
component and register the new one in
its place you don't need to restart to
make that work and I will demonstrate
how to fire because I have plenty of
time so let's go and have a look at some
of these things
down here we have thing detective from
unthinkable research there are a lot of
components installed from this machine
and you can some nice graphical view of
them they all have a name most of them
have a name and have a type subtype and
you can sort by all of these things
let's go and see if we can find the
components that we were playing with
earlier let's look for photo/jeff here
we are here's the graphics exporter
component let's keep going down find the
graphics importer here we are so let's
see what it can tell us about this it
says tells us the pipe subtype of
manufacturer it says there aren't
currently any instances if I went an
open bed and picture viewer is this
number will change to one can also tell
us about the file it came from can tell
us information about the thing resource
it's actually found a bug it's actually
found that the icon resources are
missing or perhaps should not be listed
I don't actually recommend that you
store icons and side your thing
resources they're mostly a waste of
space in the file they're not used by
many parts of of the browsing
applications and can t 1 but it doesn't
make any difference this is a totally
benign problem there's also something we
added in cook x 40 called public
resource maps these are a way of
attaching extra information to
components there are a few places where
this is this is nice it basically lets
us make some of the API is much faster
such as the dialogue that came up that
showed the QuickTime effects it's faster
for it to build that list because it can
have work out the names and the
properties of individual via effect
without having to load and open each one
in turn if you can just pull information
out using the component resource map we
can put a public resource map then
that's a lot faster we all can also
browse the flags that this component has
set and it moves out some of these by
name which is rather neat it can also
run the can do function on the component
to see which things its support and you
can see this supports all of the
required selectors and one that's one
that's not required and here are all the
ones that are specific to graphics
importers super what are compounded
aliases it can also tell us a bit about
them here this component is a second
alias you notice that some time for the
first one was Jay little dead little
dead space this one is in uppercase and
there's a bit that's set in the the
flags which says that this is actually
to be interpreted as a filename
extension rather than the file type so
it's the second alias to first component
so this is an this is a component alias
and you can tell here and here's the
compiler that it's an alias to so this
is a way of going through and checking
that your component is correctly set up
and it's saying all of the things that
you think it should it's nice way to be
able to interact with the with your your
software sing detectives is available
now you can go to the website www I'm
thinkable calm there's a plug we also
have some image decompresses I said that
video filters will implement as a
special cases of decompresses and here's
the video go one from revision effects
so that's the nice pretty view it's your
programmer or you happen to if your
programmer and you know how to use next
bug and you're not frightened by it then
there is build photos that i mentioned
using the thing become and i'm going to
drop it to max bag now don't be afraid
ok i can print out a list of the
components for the here there's a lot of
them so i have to page through i can
also type thing and then one particular
component type just to print out for
instance let's print out the RTP
reassembly components you're the ones
that installed on this computer i can
print out a list of the open components
by saying things oh and here you see
that there are a few components are open
all I must have movie player running
there's some help them with the D
command helps for that it's obviously
nicer to use a graphical view for some
things but if you happen to be crashed
when you're working out why it's very
useful to have the thing bigger might as
well let's let's leave this lime
installed there let's talk about while
you're debugging a new component I have
here the one of the sample components on
the website it's a set of graphics
importer movie importer and image
decompressor for a file format called
electric image and I've modified this
slightly I've put all the components
that were pre built into one file and
I've also changed their names to have
spaces so you'll see them in the the
window behind me but first of all let's
bring up quick time player oh it's the
same one cool and let's try opening
these see where are we you can pass hey
as a file here but I can't open it ah if
i install these and you didn't see me
reboot did you
now I can open it we what a fun file
format this is we also notice that these
components of have all appeared in this
list and if we would watch the open
instances these numbers would probably
jumped up and down as well so that's a
great way of confirming that things are
basically working well and to some
extent it can help you with
troubleshooting that's all i can think
of with those so let's summarize we seem
to be early in its in luck tom was
talking about Mac os10 and basically not
much has changed a few things that you
need to clean up as part of your
carbonization of your applications
aren't a big deal Greg pointed out some
of the api's that we had that were added
in quick time for one while your
carbonizing application is a good time
to have a look at those and see if you'd
like to support 64-bit files offsets vbr
sound if you are found out and certainly
you're all capabilities in your app
those can be a lot of fun we have a
quick time feedback forum we don't tend
to do Q&A in concessions because one
person's question is tend to be
interested interesting to about ten
percent of the audience mark ninety
percent however for those of you who are
really interested in hearing what other
people have to complain about I
recommend that you come along to the
quick kind feedback forum it's today
it's at three besides three or 330 p.m.
in room j1 and it'll be a lot of fun
that we offer people on the stage and
under the big spotlight the quick file
API mailing list is a great resource for
asking questions or having other kinds
of discussion about API level
programming issues there are a number of
QuickTime engineers who read the list
and when we have time we sometimes reply
to
two things sometimes we don't have time
or sometimes people don't ask very
polite manners but if you're lucky even
if one of us doesn't have a time another
developer will have been down the same
path as you you're trying to tread and
they can help you out as well so it's
it's got a nice it's got a nice
community some of the things that some
of the specific things that you'd like
to to find about can be found in the ice
floe notes there's a whole lot of stuff
on the quicktime developer section of
apple's website there's all of the the
sample code it's all of the tech pubs
there's tech notes there's also the
QuickTime engineering teams ice floe
notes which are extremely condensed bits
of information about specific issues
that we think a really important or have
a ABS have a very strong focus for some
group of developers there's also a PDF
file on the web which we seem to mention
every session about the new things input
x 4.1 it's not that hard to find you
should go and look if you get to the
quicktime roadmap i think there's a red
link to go to the to the PDF and I
heartily recommend it it's grand but I
think that's it I think we're done I
look for to seeing you at the feedback
for thank you
[Applause]