WWDC2003 Session 708
Transcript
Kind: captions
Language: en
so in this session today we're going to
cover some of the new things in quick
times api's we're also going to talk
about the basics of quicktime what you
can do with quicktime in your
application as you already know
quicktime offers for your application
the ability to playback media the
ability to capture media from the analog
world or from the digital world it
offers you the ability to create content
inside of your applications even to
create content from your documents that
you might not consider as having
anything to do with video or anything to
do with audio and we'll show you some of
that today you have the ability of
course to edit already created content
in your applications and finally
QuickTime offers you an ability to
deliver media out to the world did we
mention something about the hundred
million downloads of QuickTime six today
also the fact that our plugin for
browsers is well integrated with
browsers all the browsers festo we
support those looks about this long we
have the ability to deliver media via
people's Mac accounts we have the
ability to stream media and there was
something about 100 million downloads of
QuickTime six since it was first
introduced as well I think I might have
mentioned so anyway you have no problems
delivering QuickTime media to the world
one of the topics we're going to cover
today is quick times platform
citizenship what does this mean as you
may know quicktime native platform was
the classic mac OS it originally shipped
i think at the beginning of 1991 someone
will correct me if i'm wrong and at that
time the current mac OS was system 7 we
ran on system 6 at that time as well and
some things have changed one or two in
the ensuing years we're going to talk
here at this session about how good a
citizen quicktime is on today's
platforms and as i mentioned we're going
to talk about some of what's new here
what you will learn in this session well
you've already learned what you can do
in your application with quicktime so if
that's the only reason you came thank
you very much there are other sessions
next door in down the hall also we're
going to talk about media facilities for
the modern OS I have no idea what that
means but it's just a way to get you to
stay instead of leaving also we're going
to talk about what it's changed in the
OS and how quick time is changing with
it we're going to cover some answers to
come
questions during this session here right
here from this stage you will learn how
to open a movie giving a path to a file
in the form of a CF string what if i
have a CF URL that points to some media
how do i open a movie that I can play
from that well what if I'm trying to
draw to a CG context and I have a
QuickTime movie how do I do that am i
building up the tension for you
appropriately and other questions we're
going to cover as well if we don't
answer your specific question in this
session fire me and come to the
QuickTime labs it's in Sacramento which
is downstairs near the cafe it's not up
highway 80 okay also in this session
we're going to cover the use of
QuickTime with a number of different
frameworks technological frameworks that
you may be using to develop your
applications will cover quicktime in
carbon of course quicktime is in fact a
carbon API itself so that's an easy one
we're going to cover quick time with
coco quicktime for java and also by the
way many of the api's is not all of them
I can't specify are available for win32
as well so if you're building
applications using win32 api s we have
solutions for you for media okay so
you've seen already at the show a number
of prime examples of what quicktime can
do in applications and you probably use
some of these in your own work we have
some obvious ones on this list I movie
Final Cut Pro Final Cut Express create
video so you would fully expect that
some use of quick times is going on
under the covers and I can confirm
without a doubt that it is rumored that
there is some use of QuickTime in those
applications but quicktime is also used
in other applications that you might not
immediately connect it with and i have a
list of stoneham here and in fact i'll
show you one or two right now if i could
have demo one up I like this better this
is not the long walk that we have
downstairs okay i'll decide later
so I have iphoto here I photo is an
application that works with still images
of course it works with your digital
camera seamlessly so that you can import
images from your camera you can edit
them you can make different things out
of iPhoto photo albums slideshows
quicktime is actually used quite
extensively in this application for
importing images for reading image
formats for creating thumbnails but
there's some other interesting things
going on here as well I photo is capable
of creating digital media in the form of
QuickTime movies there is an export item
here from the file menu that you might
not have seen it has it the QuickTime
choice up here in this panel that allows
you to create slideshows I've created a
couple of them for you I have a
confession to make and that is in about
20 minutes my son is playing in a little
league game so since I can't be there I
thought that I take a little look here
so these of course are images that were
imported off of a camera and I photo has
made a nice slideshow of them for me and
it's added some nice effects here that a
quick time is currently rendering its
exported those images along with a
description of the effects I'll to a
form that quicktime can read and this
can all be delivered in the form of a
QuickTime movie well I don't really like
the speed at which I photo has set the
dissolves it's using a uniform time for
all the dissolved so what I actually did
was I went and I exported to more
slideshows from iPhoto and I have some
of these slides here sped up so that I
can see the dissolves happening more
quickly here and then i just used cop
copy and paste editing and quicktime
player to take the media that I photo
created and combine it into a form
that's more customized for me so once i
get to you see that this uniform speed
of the dissolve but when i get to the
action shots here like this pitching
motion I've just pasted that part of the
other slide show in here so here's an
example just using copy and paste
editing how quicktime can combine media
together
all of the facilities for importing and
playing this media are available to your
applications as well one of their app
that I wanted to show you that you might
assume uses quicktime media is keynote
and of course it does you can drag and
drop media on two slides in keynote and
keynote will be able to play that media
onslaught but what you might not be
aware of is keynote can also create
movies you can export your presentations
to QuickTime movies let me show you what
that might look like in keynotes export
menu drops down an ice sheet gives you
some choices one of them is quick time
from keynote you can create interactive
slideshows which have the same ability
to be controlled by the mouse and the
keyboard as keynote has itself you can
also create self playing movies with
timed builds and time transitions i went
ahead and i created a movie that has all
of the slides for this session right
here let me close up some windows
now I made this a very small one so I
could email it to you after our
presentation is over so you can review
this X your leisure what i'm doing here
is i'm controlling this movie in exactly
the same way that I control the slides
in keynote I'm using the right arrow key
to step through I think what I'll do is
email this to my mom afterwards so she
knows what I've been up to for the last
two weeks okay so the point of these
demos is that you can do this in your
applications as well and we're going to
talk about how you can do that in this
session can we go back to slides please
I know it's confusing because we were
showing the slides but I want to go to
these slides okay first some
abstractions some things that have not
changed in the last 12 or 13 years since
QuickTime was originally just a gleam in
Jim Batson's I some of the fundamental
abstractions that you will want to be
aware of if you use QuickTime api's
we're going to go over right now first
of all what is a QuickTime movie well
it's just an organizing principle it's
just a catalog that tells what movie
what media should be played in what
order it should be played and what its
spatial relationships are formally a
catalog of playable and editable content
that describes the sources and types of
content to be played together with its
spatial and temporal organization took
me a while to come up with them inside
of a movie there can be one or more
tracks a track is just a sequence of
media it has a shared set of properties
spatial and temporal and typically also
has the same characteristics so a track
would typically be all audio or all
video or perhaps all MPEG a track plays
media notice that we've gone three
levels of struction down and we haven't
talked about actual content yet a movie
is just a catalog a track is just a
sequence well finally we've gotten to
the level where we're actually talking
about what bits get plates the media is
just it's just a container of playable
stuff and mpeg-4 file a WAV file a
QuickTime movie file is also an example
and in this particular graphic what you
see as a single track which plays one
media file for one section and follow
that up with a second media file how
does the tracks how does media finds the
media that it plays by means of data
references data references are actually
the main abstraction that we're going to
talk about for the next several minutes
in this session it's just a way for us
quick time to find the media that needs
to be played some specifics it's a
handle based data structure this is
important for you to know the handle in
from the parlance of the classic
macintosh memory manager now the carbon
memory manager you will call dispose
handle to dispose of a data reference
that you create and you'll use other
handle based api's for manipulating it
how big is it call get handle sides and
so forth it's semi-opaque because some
types of data reference we don't publish
the format outs and some we do for
example one popular form of data
reference is a carbon alias manager
alias so you can actually take a look
and see what's in there and use the
alias manager api's together with those
but some of them are also okay now using
these simple abstractions your
application can support all of the media
formats that QuickTime supports all the
video all the audio all the still image
all of the interactive formats I grabbed
this page off of the web and the folks
across the hall did a nice job of
integrating it with my presentation the
QuickTime product specs actually lists
about 200 different formats now that you
that we can support in the last year
without you having to do any work in
your applications if you are already
using the QuickTime api's we're going to
talk about today you have gained support
for the following formats in your app
and paid for along with mpeg-4 AAC audio
jpeg 2000 is still in each format we
deliver support on that on Mac OS 10
3gpp you saw how many pieces I think
anyway you saw a demo this morning of
QuickTime together with cell phones and
the open standard 3gpp for delivering
video and audio to phones and together
with that the audio one of the audio
formats
that's in the 3g spec AMR and finally
the most important one that we're
announcing for the first time in this
session waveform at 49 thank you some
fans there of CSM audio ok so the
abstractions that we just went over
those have remained the same for the
last 12 years if you put those into your
toolbox they will remain the same for
the indefinite future as well but some
things have changed now we didn't
immediately realize this as we delivered
quicktime for mac OS 10 but some things
around quicktime change in the
transition from the classic mac OS to
Mac os10 some things underneath
quicktime such as the file system and
the graphics subsystem and well the way
we do audio and oh I don't know the way
events are handled and the way we do
concurrency and threading and all the
way text is rendered on the platform
well a few things have changed since
1990 and what what we want to say is we
are trying to keep up and we are
so in our spare moments when we're not
delivering support for new multimedia
formats such as the list that I gave you
just then and others that I can't talk
about or playing with new pics let
codecs or such things we are revving our
AP is to make QuickTime a better
platform citizen on all the platforms
that we deliver quicktime for so let's
uh let's go through some of these topics
files will be my first one and we'll
talk about new AP is that you can use
we're getting away from some of the
legacy data structures some of the
legacy idioms for the way things are
talked about on Macintosh and adopting
the new one now quick time though you
may not believe it did not invent the FS
spec there is a rumor that FS spec first
appears in the oxford english dictionary
there's a reference to it in the obscure
canterbury tales the hackers tale in
fact the truth is that was only that was
a missa appropriation the the reels FS
spec was the first delivered on system 7
concurrently with quicktime and
quicktime of course adopted that data
structure for specifying files and our
AP is are literally littered with fsx as
parameters to various calls now that's
not so convenient when FS specs are no
longer the preferred way to refer to
file so what do we have we have in
QuickTime and abstraction that we
mentioned earlier the data reference
that allows you to refer to files to
urls to other locations that media might
be stored in an abstract way and so with
data references you can read data from
media and play it you can write media
back to locations out in the world what
we have with QuickTime 64 on Panther are
the data rescue till ities new AP is for
creating data references that you can
use with QuickTime here's an example of
one of them suppose you have a path to a
file maybe the name contains unicode
characters you want to open that file
and play it as a movie what you do is
the following use this new API QT new
data reference from full path CF string
and it will create a data
for you let me show you an example of
what this might do in a moment we not
only can create these data references
from full paths there are also AP is if
you have partial paths together with
anchors if you have URLs hey even if you
have an FS spec we also support FS rest
from the carbon file manager before I
show you any of the code snippets
however that you can just drop in your
application I want to say two words
about enter movies call it this is how
you distinguish the afternoon session
which we're talking about real ap is
from the morning session which is driven
by not showing the api's but showing the
technology we're going to tell you
remind you that even on Mac os10 is
still necessary to call enter movies
before you call any of the movie toolbox
routines here's just a caution if you're
calling it from cocoa and yes we support
calling these api's from cocoa if you
have a class method that goes on to call
some movie two locks function some
quicktime api's anything in the
QuickTime framework it's probably a good
idea to position a call to enter movies
somewhere that's sure to be invoked
before any of your class methods are in
vogue so this is just an example of how
it might you might do that calling it
from the initialized class method okay
so here's an example of using that data
rec utility to determine if QuickTime
can open a file you want to call the
QuickTime API can QuickTime open data
rep that will tell you can quicktime
open the file it can also tell you do we
prefer to open it as a still image or
can it be an image or does it prefer to
be a movie what you want to do is take
the form of reference that you have a
path a URL what have you call the
appropriate data reference utility to
create a data reference and then use
that in can quicktime open data rest and
as i mentioned the data rest is a handle
based data structure so before you go on
to doing other things please dispose of
the handle if you're not going to use
that data record any longer it's not a
reference counted item that's going to
be disposed of for you at some time
suppose you want to open a movie from a
file
same data reference utility QT new data
reference from full path CF string of
course if you have a different form of
reference use a different data rec
utility the call that you use this new
movie from data wreck this one call will
work with the entire range of formats
that quick time support you can open WAV
files locally from the internet you can
open aiff files you can open 3gp files
you can open a mr files you can even
offer wav files that are encoded with
waveform at 49 with this one API now
it's very important from before I move
on to mention up just to caution you
it's very convenient in your
applications in your pee lists to list
all of the file extensions and all of
the mac OS file types that you know how
to open well that's great and at least
fast for you to check whether particular
file if it's dragged onto your document
whether you can accept accept that drop
by checking whether it's file extension
or its Mac OS file type is in that list
of things that you support however you
have to remember that if you support
dropping quicktime media on your
applications quicktime is always
expanding the set of media that it
supports so you do want to call can
quicktime open data rep to determine
whether you can accept the drop of media
for example keynote does that and when
keynote when quicktime 6.3 shift it was
immediately able to support dot 3gp and
AMR files without having to be revived
okay open a movie from a URL same basic
sequence different data rec utility QT
new data reference from CF URL suppose I
want to write a movie to a file I want
to create a new file or I want to
overwrite an existing file in this
particular example I'm calling the same
data rec utility QT new data reference
from full path CF string but this time
I'm referring to a file that may or may
not exist that will work just as well as
the earlier uses where we're opening an
existing file in this particular case
and this code snippet there's a slight
wrinkle I create the data ref then i say
i want to create storage for a movie at
the location that the data ref points to
by means of create
movie storage if you take a look at the
parameters there you'll see that we're
saying go ahead and overwrite anything
that was already at that location we're
also supplying an HSS creatorcode to
identify it as being associated with our
application what that call returns
create movie storage is an instance of a
data handler you can think of it as an
object that will just do the writing for
you it is in fact an instance of a
component a QuickTime component that
knows how to read and write data from
data references of the type that was
returned in this case by a cutie new
data reference from fullpath CF string
so that thing will know how to write the
movie to that storage and it will do
that when i call add movie to storage i
tell the data handler please do that
work for me and once i'm done i say
closed movie storage that will you know
close down an open connection or close
and open a reference to a file and it
will also close the instance of the data
handler now since i'm done with the data
ref i disposed of it this snippet of
code will be capable of writing movies
to any type of storage that quicktime
has a data handler that knows how to
write so this will work with files and
other forms of storage as well and of
course more immediately it will work
whether your past names have unicode
characters or any other sort of of
characters I should have mentioned
earlier that in the call cutie new data
reference from full path CF string that
is a mouthful we tell when you tell us
the type of path that is we typically
give that type of path as the native or
default type of path but we support a
range of past types as well okay you can
do a similar thing in Cocoa without
telling quick time to write to the file
via add movie storage or something like
that you can get from QuickTime a
serialized form of the movie in memory
by means it's put moving into handles
that will give you the thing that you
want to write some place and then in
this particular snippet i'm using NS
data i'm actually copying that
serialized form to an instance of a test
data then using NS data to write out the
file so this will work perfectly well
also for extra credit if you can rewrite
this code snippet not to copy the
serialized movie in memory
I will say a hearty congratulations it
is possible but it goes beyond the scope
of what we're going to talk about today
all right so what did I write in those
snippets I wrote movies two files and as
we said earlier a movie is just a
catalog it's just organizing data it
doesn't necessarily include the media
also what if i want to write the movie
the organizing catalog together with the
media in quicktime parlance that's
called flattening the movie to a
location and the api for doing that is
flat movie data to data ref get a data
ref flatten the movie to it and you're
off you now have a file in this
particular case with all of the media
data and the movie stored in the same
place okay so here's something that I
know that we haven't shown on a WWDC
stage before and as soon as I show you
this I'm going to show you how you can
get in serious trouble using this if you
want to know what media a movie plays
it's possible to do that all you need to
do is to iterate through the data
references that a movie uses and then
here's how to do it you use the
abstractions that we talked about
earlier in this particular case I'm
looking at the first track of the movie
but of course I can iterate through all
the tracks in a more involved example
that wouldn't fit on a slide now I get
the media for that track and then what I
want to do is make sure that all of the
data references that that media uses are
going to be resolved against the anchor
data wreck of the movie I do that in
case any of the data references used by
the movie are relative for example if
they are intended to work regardless of
where the movie is if it's on a local
file system or an HTTP server the data
reference is stored in the movie might
point from that location of the movie to
some point relative to it so I want to
resolve all of those data references
against the anchored a terrific of the
movie and here's how I do it in this
code snippet I get only the first media
data rest but of course I can iterate
over all of them if that's what I'm
interested in then I open a data handler
for that data ref by means of the call
open a data handler who said we had a
naming problem in our AP eyes I think
that's perfectly self-explanatory
once I have the data handler I have
another set of data reference utilities
that I haven't mentioned yet that allow
you to get information back from a data
handler about a data rep in this case I
just want the full path back I want to
know where these files are and I want to
be able to manipulate them with other
api's in a file manager for example or
in the carbon file manager and here's
how we do it make sure you clean up
close down your data handlers dispose
your handles and everybody will be happy
from this you can get a complete list of
all of the media than a movie plays now
I need to take a moment for a graphical
interlude we got these cool graphics
last week and the advice to mark all of
our code snippets either with this best
practices icon or with a different icon
now I didn't have time to do all that so
I wanted to tell you that if you're used
to seeing these icons during the show
and you're reluctant to use any code
snippets that are not marked in that way
all of the code snippets in this
presentation unless otherwise noted are
best practices they've been certified by
a board of QuickTime API engineers who
are sitting I think Greta there now
after saying that I immediately show you
something that is not a best practice in
this particular case I'm going to use
the power that I've just given out to
the whole world to iterate through all
the data references in a movie and I'm
going to load all the media data into
memory in one small loop now this is a
very interesting thing to do and it
might be fun if you want to swap the vm
but it's something to avoid if quicktime
is capable of playing large amounts of
media data without loading it all into
memory it's probably possible for you to
examine it or copy it or do whatever you
need to do without loading at all in the
memory too you should be aware that
these data rests can point to very large
amounts of media data gigabytes worth of
DV or audio or you know high-res video
of some kind and it's probably not a
good idea to write code that loads are
very media into memory like this okay so
i can open movies i can write movies
back to files suppose i want to write a
movie to a different kind of file i want
to export data from a movie to a
different file format here's a code
snippet using the data ref utilities
that takes the audio from a movie and
exports it to a WAV file it's just a
tease and just that quick there are some
additional parameters that i'm not using
in the API convert movie to data ref
that allow you to specify a movie export
component that you've already configured
with some export settings so if you want
to specify some compression on the audio
you can do it in that way all of these
kinds of samples and methods are
available in our library of sample code
on the web that you can get to from w
apple com what i'm doing here are
supplementing things that already exist
with updated api if you want more
details about how to use these alright
to come to the lab or browse the sample
code that's available so we talked about
movies the same procedures work for
opening images how can you draw in any
image in any format that quicktime
supports get a data reference then get a
graphics importer for that data ref
using the interestingly named API get
graphics importer for data ref with legs
a graphics importer is an object again
it's an instance of a QuickTime
component but you can think of it as an
object that has methods that do things
with images like draw them or transform
them or export them to other formats for
example if I wanted to export an image
to a file all I need to do is open an
instance of a graphics exporter in this
particular snippet I happen to be using
the painting exporter because ping is an
excellent graphic image file format once
I've got that open I want to tell that
instance of the graphic exporter what
the source of the image is I'm saying
please make the source of the image to
export this graphics importer I just
open a moment ago using the method that
i showed you getting a graphics importer
for a data rest then one I want to tell
the graphics exporter
we're to write the image file by means
of again a data reference and then I
tell it to do the export and was that
few lines of code you can write any of
the image file format that quicktime can
write and of course clean things up
close components dispose handles so that
covers the basic level of data reference
utilities we hope this will get you past
some of the some of the blockers and the
conceptual blockers that developers have
run into looking at the QuickTime api's
for the first time on Mac OS 10 and
saying some of these things are not like
the other we're trying to be more like
the other and make it easier for you
alright so let's move on to graphics
subsystems things have changed in
graphics when quicktime in its nascent
years it's the native graphics subsystem
was of course quick draw on the classic
mac since then other graphic systems
have become available also now i want to
say like i said for files that we have
an abstraction that will shield you from
all the details of all these graphic
subsystems and if you use our
abstraction then you don't have to worry
about the details of the underlying
graphics subsystem and if i said that it
wouldn't quite be true but we have
something of that flavor we still use
some of the basic quick-draw data
structures and api's but you can use
them in combination with the graphic
systems that you are using in your
application and i'll talk about how to
do that if you want to play a movie in a
window what you need to do is to get
from the window it's quick-draw a port
and that's a very simple thing to do in
carbon or cocoa if you have the carbon
window rest you get the quick-draw port
that's associated with that window by
means of get window pork then you can
tell quicktime to draw a movie there by
means of the API set movie G world in
cocoa you can get the carbon window ref
from NS window from a public method
called window rest so this is all very
straightforward but you say I wish to
play movies into off-screen buffers how
do I do that well if you have the buffer
set up and all you know is the pointer
the location in memory where the pixels
are going to be drawn
you know the bikes per row of your
buffer you know the the size of your
buffer the width and height and one more
thing you need to know the quick-draw
pixel format or you need to map from the
pixel format that you're using whether
it's a chorographical quartz pixel
format or an opengl one you need to do a
little mapping to the QuickTime or
quick-draw way to describe that pixel
format then you can create a data
structure that allows us to draw the
movie there you call new g world from
pointer with that information and that
will allocate a G world that allows
quick time to access those bits your
buffer which you may be doing other
things too also you might be composing
movies as other things and so forth this
is exactly what keeno does by the way to
be able to render movies to OpenGL
textures it creates a G world that
QuickTime can use to render to that same
area of memory ok same thing for images
in this case you create the G world and
then use graphics imports that G world
to do the same thing and then graphics
import draw to draw there but suppose
you have a CG context that's not a
bitmap context I don't have the pointers
of pixels I just want to draw a frame
with my movie to an arbitrary CG context
because I might want to print for
example my documents well here's how to
do that what you want to do in this case
is extract from the movie and image of
the current frame and we'll be using
core graphics in this example to take
that image which happens to be in the
form of a quick draw a picture and turn
it into a form that core graphics can
render itself to any arbitrarily
arbitrary CG context the key API call
here is QD picked draws the CG context
this is a public API that you can use
this method will work for you all these
code snippets by the way are available
in a document that we're making
available via your ADC connection so you
don't have to jot all this down in fact
the samples in that document are a
little bit more are a little bit fuller
than what I'm able to show on stage
again I'm cleaning up after things how
old is the API kill picture does anyone
know how many ww seats have you been to
enough to know well that's that's more
than enough okay so CG images you don't
have to get a quick draw picture to do
all operations in quick times we now
support the ability to read still images
and give you a CG image but we sport the
ability to take a CG image and right out
to an image file a new graphics importer
call graphics import create CG image
will give you a CG image from any format
that QuickTime can read by a graphics
importers via this method and similarly
you can write out to image files from a
CG image using graphic exporters we saw
the example before of how to use a
graphics exporter the only difference
here is I'm using the API graphics
export set input CG image to tell the
exporter to take the image from the CG
image and then write that out how many
disposed handles have I shown during the
sessions probably more than you've seen
anywhere else at this conference so far
ok so let's take a break for a few
minutes from code snippets something
else that has become more widespread on
the OS is color matching Tim Schauf
mention it this morning so I won't
repeat all of this except to illustrate
that by default graphics importers will
match when they draw if there is a color
profile stored in the image this happens
by default you don't have to do any work
so when Tim shop showed his demo of
bbedit suddenly able to do color
matching did that require any changes to
bbedit well no it's just using graphics
importers and now it just works however
something that Tim didn't mention is
that if you use some of the code
snippets i showed you to translate from
one graphics image format to another you
should be aware that we now as much as
the image format allows us move the
color profile over from the source of
the definition to the destination and
this just happens it just works more
details about how to do this
particularly if you're already doing
color matching of your own when using
graphics importers come to session 7 16
advanced QuickTime programming
techniques and there they will speak
even more advanced language than I'm
capable of speaking
another subsystem that's changed
underneath quick time we are changing to
keep up is audio we have on Mac OS 10
core audio you heard this morning that
we have a complete reimplement ation of
quicktime sound media on top of core
audio you have the opportunity to try
that out on your Panther seed disc once
you install that one of the things that
wasn't mentioned this morning just as
you can use QuickTime in combination
with quartz in the ways that I told you
earlier you can use QuickTime in
combination with core audio come to
session 7 11 to find out how to extract
audio from a movie in a form that you
can manipulate using Core Audio so these
technologies work together better than
they ever have before alright another
area that's changed underneath and
around quick time we have a new text
rendering engine on Mac OS 10 it's the
apple type system for unicode imaging
and it stands for something and in any
case it is the native rendering engine
for unicode on mac OS 10 and it does a
great job of rendering unicode what
quicktime has done on the maps before
you could always store unicode text in
your movies since quicktime 3 on mac
however we were transcoding the Unicode
to a different encoding before rendering
it and so you lost some some
faithfulness to some fidelity to the
text that's no longer the case we have
complete fidelity to unicode text when
rendering now there's a cost and i want
to be clear on this you're going to lose
the ability to render text with quick
draw shadow or quick draw outline yeah
how many people here have looked at what
quick-draw does to add a shadow to a
bitmap slot how long has it been take a
look again if you're worried about the
loss of this take one look and you won't
worry anymore let me give you a quick
demo on demo one of what this might look
like first of all I'd like to open in
Xcode which is a very nice texted or
among many other features
a description and XML format of what a
text track might look like here are
starting with QuickTime 63 we have the
ability to specify Unicode text we're
using utf-8 encoding in this example
because it is stored as XML and we have
the ability let me highlight this for
you it's hard to see in the back I know
but you can set an attribute that says
right to text vertically what does it
look like well let me import it with
QuickTime right now the very same XML
document and this is what it looks like
the first frame renders the text
horizontally and you see that if I scale
it down scale it up we have very smooth
text now and the second frame writes the
same text vertically so that's all
available for you once you have this
text into a text track of course you can
move it around with the QuickTime media
just as easily as any other let's move
back to slides all right so we talked
about some sub systems that have changed
things that have changed around and
above quicktime include the user
interface now this has changed somewhat
since 1990 for example we don't have
modal dialogues anymore we have panels
but not only has the terminology change
also the way that users interact with
these things have changed and their
appearance has changed quite a bit as
well quicktime has some UI of its own
that you can display in your
applications for configuring operations
such as recompression export-import if
you choose to display this UI you get
well as standard UI that may or may not
match the other UI in your application
that's a problem that we're going to be
working on over time you're going to
tell you how we're going to do that but
the good news is and I'll show you some
code snippets in a moment you can now
display certain quicktime modal
dialogues as sheets with quicktime 64
and Panther standard compression audio
and video the effects parameter dialogue
you'll be able to show a sheets now how
are we going to move from where we are
now where you need to use quick times UI
to get full access to all of the
settings
quicktime operations to where we want to
go in the future where you can use
totally custom UI in your applications
to configure quicktime processes
exposing only those options that make
sense for your application and
defaulting other options well we have a
new API at the component level that
we're just going to introduce to you
today and we'll be working with you over
the next year to make sure that we get
to where we're eventually going it's
called component properties first in
code snippets if you want to display
quicktime standard compression dialogues
as sheets we have a new SD set info the
standard compression set info api
selector that tells you to display a
dialogue as a sheet instead you tell it
what the parent window is if you have
the carbon window rest it'll just work
and when you say SE request image
settings the standard compression sheet
will now come down from the window title
bar actually would expect on mac OS 10
it's also possible to do that with a
video compression dialogue and it's also
possible to do as i mentioned with the
effects parameter dialogue as well what
we do in this case is we call QT create
standard parameter dialogue setting the
option pd options display a sheet and
then we tell it to do something clever
this api was originally designed to work
with the classic macintosh dialogue
manager muldiss dialogue support now we
just tell the parameter dialogue to run
itself in its own event loop and that's
what it does it brings down the sheet in
this case handles the user interaction
and then when the user dismisses it it
goes away and UX you have the settings
that the user selected ok I'm running
behind so instead of showing your sheets
coming down from title bars I'm just
going to stay with the slides sorry
about that meantime someone can
translate the text that we put into that
movie okay component properties this is
an important direction for us if you are
a developer of a movie exporter or of a
codec or
of anything that is used in combination
with a QuickTime process we would like
to work with you over the next year to
standardize sets of properties that are
common for your component type you can
imagine that exporter's will have a
common set of properties and we would
like to roll out in a way that's similar
to the way over time Apple work with
developers to add support for apple
events in their applications with
standard apple event sweets we want to
work with component developers to add
support for standard property settings
this will allow us to factor the
configuration of QuickTime operations
from you I so you'll hear a lot more
about that from us over the lifetime of
Panther and QuickTime six you'll see
these api's in the QuickTime framework
on your Panther seed these api's are
actually part of the component manager
although they're not in that that's a
framework that the component manager is
part of on your seed disk okay so you'll
hear more about that in the upcoming
month all right something else has
changed it is now possible to do
operations on concurrent threads and
there are many different threading
models that are available on Mac OS 10
however there's been some difficulty to
date of making QuickTime processes
operate on secondary threads we really
wanted to operate on the main thread now
we have the ability as let's mention
this morning for a certain set of
operations to configure them and to
carry them out on second down secondary
threads that do not block the UI this is
a major win if you have an application
for example that export a lot of data
you saw my code snippet earlier for
exporting audio to a WAV file what
affects a lot of data just the user just
have to wait around while a progress
dialog tells me how much is happened
well we have the ability now for certain
processes and certain operations to
happen on alternate threads more details
in the advanced QuickTime programming
technique session please come to that to
find out how to do that especially come
to that if you are already calling
QuickTime AP is not on the main thread
because you may have interesting side
effects that you're not
we're up there are certain restrictions
that you want to be aware now you'll
note that even though that this is a
fairly introductory session to quicktime
api's and to quicktime new api's i have
departed from many years of tradition i
have not shown you how to take a movie
that i've opened and then create a movie
controller for that movie and how to put
the movie controller in a window and how
to route user events to the movie
controller then I think it's been shown
in every single QuickTime API session
since nineteen thirty-five but today we
are breaking with tradition because we
have finally arrived at a point at which
we have intermediate level modules that
will do that work for you you don't have
to worry about it any longer so if you
use these api's I've shown you to get a
movie from a file or some other place in
the world all you need to do is tell
that movie while you movie you play in
this NS movie view or you you movie you
play in this carbon movie control there
are also third-party activex controls
available if you're using win32 api and
those things are able to take care of
all those programming details for you
like well how do i get an event in the
form of a classic event record to tell
the movie that a click happen don't even
worry about it however if you choose to
worry about it there are some details
that you might want to be aware of for
example the age-old question how do i
tell quicktime well here's some time for
you to do processing quicktime movie
since they're normally heavily display
oriented if you're playing them where
the user can see them they do run on the
main threat and quicktime is architected
in such a way that playback doesn't
block the UI but the way that it works
is that the application has to tell
quick times here is a little slice of
time that you can use for doing some
processing fetch some media that you
need to decode or decode some and oh by
the way return in like no time at all so
here is what you will want to do on mac
OS 10 we now have a science whereas
before it was all magic we don't have
science attached to how often you need
to tell quick times here's a little time
for processing what I have here is a
snippet of code that I'm using in
combination with a CF timer and when my
CF timer
first time task flyers what I'm going to
do is I'm going to tell a set of objects
in this particular case that's primary
objects or underscore primary objects
things might be a CF set it's a list of
objects that manage QuickTime movies I'm
going to tell all of them run your app
lot of function that will task the
movies then once I've done that all
those objects have had their function
fire to task movies then i'm going to
call quick time to say when do I have to
do this again I call QT get time until
next task and click time will tell me
you know the movies not playing you
don't ever have to do this again or we
really need you to do it a ground-rule
fast and so quick time will return to
you an interval that you can wait before
calling this again and then what you
want to do is tell your CF timer to fire
after that interval has expired and then
this will happen again and all your
QuickTime movies will be tasked you can
set a minimum interval so that you're
not spending all the cpu time doing this
and then if the function that you might
fire on your objects that set a plier
function might cause this to be fired on
all of your objects in this case i'm
using a cocoa example i actually am
using an NS timer with a toll-free
bridge to CF timer to fire this function
that will tell all of my objects the
value parameter passed in here to call a
method idle and that Idol method will
probably call quick time and say MC idol
if it's using the movie controller or
movies task it's not so that's how to do
that on Mac OS 10 here's something
really obscure but i promise that i was
going to answer this question at
beginning of the session and since i
enforce to keep my promise that they'll
throw me off the stage what if i have an
annus time intervals and i want to tell
quicktime just that amount of time what
do i do and NS time interval is a
floating point value it is a double
precision value that expresses a number
of seconds you know as a floating point
value what I want to do is turn this
into a data structure that quicktime can
recognize as that same amount of time
what we're doing here is using some and
secure function in the mass package
please give me the magnitude of that NS
time interval and according to the
magnitude that's the / x function
according to the magnitude of that and
it's time interval we're going to choose
a time scale to use to represent the
time value in quick time so if the value
is really large we're going to use a
smaller time scale if the value is
relatively small we'll use micro seconds
because that's that's a very good time
skill to use with QuickTime then once
we've chosen the time scale we're going
to go ahead and convert that and it's
time value to a time value we multiply
the value by the time scale and write it
into the time record so if you're trying
to call an API like set movie time well
the time interval has been expressed to
you as an NS time intervals you can use
a function like this to do the
conversion you're thinking why did I
show that ok so I mentioned to you
earlier to take care a lot of these
details you can use higher level objects
that know how to do things like process
user events they know how to task movies
in some cases they have higher level
methods so that you don't even have to
use any of the file manipulation that I
showed you earlier for carbon we have
the movie control for cocoa we have NS
movie view and for java we have two
components a java.awt component and a
java swing J component that you can use
and I mentioned there are third-party
activex controls as well if you're a
carbon app you can use a carbon movie
control by the simple API create movie
control and it will do all the work for
you we're revising the carbon movie
control 260 the major got your with it
that there were some limitations in its
use if you combine it with the use of
HIV use in a carbon app some problems
with setting the clip we're going to
take care of that for you in QuickTime
64 let me show you just how easy that
can be
so back to Xcode recent project dem only
the control here i have a very simple
application that well plays arbitrary
QuickTime movies basically since you
probably can't see the whole flow of
code in the back of the room it does
call ender movies it's a good citizen it
prepares quick time for calls upon movie
toolbox functions it then calls a
function that implements itself get me a
movie that uses some of the very same
api's that i showed you earlier what
this function does is use as a panel to
allow the user to select a file and
extract from the API that displays the
panel our reference to the file then it
creates a data ref for that file and
opens the movie buy a new movie from
data rep then what it does is create the
carbon movie control while create movie
control and it does a little
housekeeping with the control and that's
basically it that's all it takes for
your application using carbon to be able
to display arbitrary QuickTime media so
I should be able to open up any of these
movies that I created earlier have
little bug here got to resize this
report shows up and here it is this
slideshow that I photo created can be
displayed in this carbon app with just
that amount of code something similar in
cocoa in this particular example I was
too lazy even to alter the example this
simple cocoa movie is available for you
as sample code on apple's website it
uses NS movie and NS movie view in order
to implement a very simple application
that does something very similar in this
particular case instead of displaying a
panel to allow the user to choose
arbitrary media it reads the media from
the application bundle itself using NS
bundle well how does it do that it gets
the URL for the media from NS bundle
create the data rep for the URL and then
use this new movie from data rep and
then it opens up the movie and displays
it in an NS movie view
thank you for the audio should turn it
down okay so that's all that you need to
do back to slides
if you are using Java the good news is
our support for quicktime for java is
ongoing we have a new version of
quicktime for java java 6 dot one is its
version number that's available for
seeding I believe today you can get
access to it from your ABC account it
works with both JDK 13 and 141 on
windows with the sun java vm and on Mac
OS 10 it has a complete up to date set
of bindings to quicktime capi so all the
api's that we've gone over today and the
other API is in quick times API set you
can call using QuickTime for Java but it
also has higher level modules in the
QuickTime task view package for
displaying movies both use an awt
component and a swing component that you
can use now if you're using earlier
versions of QuickTime for java some code
migration might be necessary we'll talk
about the details in a moment but let's
look inside the package to see what you
get we have a number of classes that
will do some work for you if you have
some media and some references to the
media you can use a QuickTime factory
class to create the components to
display the media we have some holdovers
from the earlier version of quicktime
for java duty image producer movie
player graphics import or draw we
continue to support the QuickTime ate
the java.awt component and the QuickTime
swing component I believe I have missed
named on this slides names doesn't match
what's in the the seed but don't worry
will reconcile that shortly and here's
an example of how you can use this if
you're using java.awt to display things
this is basically all you have to do if
you have a pass you say new cutie file
and then you say you want a movie from
that file create a movie controller for
that movie and then you want to tease
factory to create a java.awt component
that is capable displaying that movie
and knows how to allow the user to
interact with it that's all you need to
do if you're using swing similar code in
this case you're saying that you want a
movie player from the movie and then you
want from QT factory
the swing component that's capable of
displaying an instance of the swing
component that's capable displaying the
movie and that's all there is to that
and you can display all the QuickTime
media that you've seen here at this
session in your Java applications now I
mentioned earlier that some code
migration might be necessary if you're
using earlier versions of QuickTime for
Java we have deprecated a number of
packages some of these are smaller
packages and some of them were larger
well why have we done this there are two
reasons one some of these packages
depended on behavior that was available
on legacy versions of OS a QuickTime was
housed on and that were supported in
legacy implementations of java sdk on
mac for example some of these were
tightly coupled with quick draw support
so what we've done is fed well instead
of supporting all of that legacy stuff
what we want to do is to move towards a
model which is more consistent with the
standards that have emerged in Java over
time a number of the classes in these
packages were designed before standards
emerged in Java such as java swing so we
gave you solutions for doing things in
these packages that were completely
orthogonal to the wake apple java
application developers typically work
today so we're doing now is we're
changing our support at that
intermediate level to adopt the
standards that have emerged now some of
these packages may have things in them
that you are dependent on some code
migration will be necessary on your part
be part of the seeds find out the
details and then work with us we'll help
you make the move and we'll talk about
options I have a demo over on my Windows
machine
I've been talking so long that my
Windows machine has gone to sleep
together with how many of you has please
those of you who have not raise your
hands you went to sleep ok so here i
have an example which I will drag onto
the wall this is actually a very cool
feature of of the room here I'll drag
from my screen onto the wall here is an
example of the use of the Java 8 AV key
component that we supply for you in
quick time for Java it has the ability
of course to play the movie with high
quality audio straight out of my vaio
and the ability to select an alternate
piece of media from using standard Java
UI and display that as well quick
example of ok got a look on the wall for
my cursor and they'll all right dragging
on to the wall here's an example of the
use of the java swing component we've
we're using here several instances of
our swing component together with some
other things this is java animation down
here and here is an image using the
image drawer and here is a movie now i
show you this on windows to illustrate
the point that this is going to work
with exactly the same implementation on
both mac OS 10 and on windows using the
same java code it delivers on the
promise of the cross-platform
compatibility of java apps ok back to
slides Oh Brooklyn I am I haven't talked
too much about quicktime for coco as yet
i thought at one point while we're
developing the session that I would have
a fantastic announcement to make for you
at the end of the session that would
keep you on the edge of your seat for
the entire time however tim shop went
blew it this morning and told you that
we're doing initial work on quicktime
for coco and we'll have a seed later
this summer that goes beyond what's
already available for support for
quicktime in the app yet well let's talk
about what that support is that you
already have in the app yet
have NS movie view and NS movie they
provide fundamental support that has
matured is extremely reliable you can
with these classes manage and play all
of the media formats that QuickTime
supports very simple to use you don't
even have to go down to the sea level
API to open a movie from an arbitrary
file or URL example of usage is up there
on the wall number of apple applications
use this facility Sherlock uses is for
example to display movie trailers in its
movies channel what are we going to do
what suppose you put a bunch of
QuickTime programmers together in a room
and you gave them the problem of
designing and implementing a set of
cocoa classes that integrated well with
foundations and app kit that used the
same data structures and methodologies
that were common in cocoa applications
and yet had the flavor of QuickTime what
would we do well naturally what we would
do is to use the very same abstractions
that we talked about at the beginning of
the session the same ways that we we
talked about media in quick time for the
last 12 years we're going to talk about
it in cocoa as well here's a sampling of
the kinds of classes that you will you
can expect from us when we see quick
time for cocoa later this summer you'll
be able to manipulate movies a lot of
the very same code that I put in my
slides will be in the implementation of
QT movie so now after you've sat through
all of this you can realize if your
cocoa developer I didn't need to know
that at all because we'll take care of
all of that for you in these classes
so now it will be possible with even
fewer lines of code for you to load all
the media that a movie plays in a memory
finally we have some classes that help
us to bridge to other AP is in common
use I listed to tea time here because it
knows how to do that frecks thing that I
mentioned earlier you can initialize a
time of 2t times from an annus time
interval from a time record from the
time value from a time by 64 from a comp
time value from are there any more and
it will know how to deal with it and
then you can pass that around to express
time in quick time for cocoa so look for
that later this summer if you are
interested in this seed email don't wait
you have airport right here in the room
cutie cocoa seed and apple com and tell
us of course give us contact information
about you your name your company what
your product is described for us please
your goals and participating in the seat
and also let us know if there are unique
opportunities for us if you have a
unique use for a quick time in your
cocoa ass and you know that you'll help
us exercise our classes in a unique way
please mention that also as well in your
email okay so I covered a lot of
material in this session there's a lot
more to be said about new quicktime
api's and new capabilities here at the
conference now i want to tell you even
if you use these intermediate level
modules like NS movie view or the carbon
movie control in all of these
environments including java you have
access to the QuickTime primitives the
movie they'll track the media and you
can use the quick on C api's if you need
to to extend the functionality of the
classes the modules that you're using
also as requirements are presented to
the QuickTime team we expand and update
our API sets to cover new needs this is
happening all the time quicktime is a
living work this year alone we're
talking about threading we're talking
about new audio facilities we're talking
about improved color matching you can
expect this kind of expansion and an
increase in functionality from quicktime
every year
you can gain access to all this
functionality in your applications use
the api's that I've mentioned and your
application will grow with quicktime now
if you have needs that I haven't covered
here if you have some problems in your
applications that we haven't talked
about an excellent place for you to go
to get more information is the QuickTime
lab in Sacramento downstairs by the cafe
but there are other sessions for you to
go to as well where some of these topics
will be covered formally if you didn't
go to the State of the Union this
morning well buy the DVD the session on
that will cover more details about audio
and quicktime well how exactly did we
reimplemented sound media using Core
Audio I don't know if we'll actually
tell you all the details but how can i
use core audio in combination with
quicktime go to the session russian hill
that's wednesday tomorrow 9am get up
early be here what if i want to know
these advanced quicktime programming
techniques such as well multithreading
come to the session Pacific Heights
that's tomorrow at 2pm fact that's this
room here I believe well camp out right
back here plenty room alright if what if
I want to follow up on something that
was mentioned by Tim shop this morning
what if I want to plug in molecules to
quicktime streaming server to add
functionality on the server side come to
the quicktime streaming server
programming session that's at the
mission 2 p.m. thursday finally
something that i didn't mention here but
similar to the flavor of these
intermediate modules that i talked about
for cocoa and for carbon there is the
ability to use quicktime in other
programming environments as well well
what I just want to play a QuickTime
movie in my visual basic app yes i can
say visual basics on this stage at this
conference I think
what if I want to play a QuickTime movie
in my application that i created with
Apple scripts to do what if I want to
play a QuickTime movie in an application
i create with real basic there's a
session that will cover the details of
how to do that it's called quick kind of
alternative programming environments
lots of great music lots of great
programming Pacific Heights this room
Friday 1030 mr. music no music okay so
if you have questions after the
conference and you want to email
somebody to make sure the question is
appropriately routed York person to
contact Guillermo Ortiz quicktime man
can you do any better than that at apple
com also an alternative contact for the
quicktime coco CO 2 to cocos seated
apple com or quicktime math.floor yet
more information you can turn to the
reference library that's available for
quick times already on the apple
developer website quicktime of course is
a mature technology it's well documented
and here are some documents that has
been made available recently for
quicktime and their paths from the ADC
home so shop for information on the web
and yet more places to look on the web
for information and finally if you miss
any of the others do not miss the
opportunity to meet with quicktime
engineers those irascible yet charming
engineers who provide quick time for you
in fact provide a new version of
quicktime every whilst ever every
several weeks for you are here at the
conference and there at the quicktime
labs and they're willing to help you use
quicktime in your application so go
there and find out just how dedicated
these people really are