WWDC2003 Session 104

Transcript

Kind: captions Language: en hello my name is Patrick Collins and I'm the digital hug technology manager and developer relations we're going to be covering this recording api's today so we have the whole burning issue teen here to run through everything they'll be here for Q&A after the session and we'll get started with a drouth Baylor thank you hello and welcome so today we're going to be talking about disk recording my name is true sailor my title is recording artists I worked in the burning issues group at Apple computer and we handle everything that has to do with CD and DVD burning so one year ago the disk recording api's were introduced to the Jaguar and so this is our second session and we're going to talk about what went on in the past and we're going to talk about what's new for Panther sir topics in session we're going to go over the introduction we're going to talk about the new features in Panther for those of you that are already familiar with disk recording and then we're going to go ahead and do an overview of the API and covering both old and new stuff and we're going to talk about a new feature which we call device profile and that will be at the end of the session so let's talk about this recording what is disk recording well no one can be told what disk recording is you have to experience it for yourself no no I'm just kidding really actually you can be told with this cording is and I'm going to do it here for you today before we talk about what disk recording is though let's talk about why it's a basic problem that you have to deal with if you're an application that wants to provide digital media on CDs and DVDs is that really burning discs is actually pretty hard you know it takes several man years of work to implement all the various levels of things have to do is talk to many different layers of the operating system you have to do the user interface you have to go all the way down to talking to hardware you have to deal with all the layers of the operating system in between including threading io kits disk arbitration things like that you have to talk directly to the to the dr different drives neo might have slightly different behaviors and you don't necessarily want to deal with that from your application you also have to stream your data from the beginning of the disk to the end the CD is generally not a random writable thing you can't just copy files to it you have to start at block 20 of the disk stream all the way to the end you also can't just use normal file systems there are specialized file systems which are designed for cds which are cross-platform there's thousands of pages of specifications you know there's this whole sea of acronyms and these are just these are just the publishers of the specifications not even the specifications themselves you've got all these color books you've got the red book the yellow book orange book the green book the blue book the other blue book there's a lot of stuff to read and you have to pay attention to every little sentence and it's kind of just a big pain so and lastly and very much not least since this is the mac your application needs to play nicely with all the other applications you don't want to completely take over the drive you want the user to be able to seamlessly move between your application itunes finder whatever else so you need to play nice with the other applications so solving that problem we really need something that's ice it's easy that's fast and that's powerful so for easy it really needs to be accessible to application developers we need something object oriented it's going to give you a nice high level easy to interpret view of the task at hand you need to hide the hardware difference you need to have an abstraction layer that's moves out the differences between all the devices and just treats a CD burner as a CD burner because of the things with file systems and creating the different types of data you know there are some pretty common tasks in there that would be duplicated you don't need every application to become a master of you know three different file system formats you just need to it would be nice if there's a helper to help you do that sort of thing having a common user interface between applications is good it should be kind of fast some applications function by writing out all the data to disk first you know creating a CD image on the hard drives and then sending it to the dips and they get to the cds and that works but you you wind up touching the data three times once while you're producing it once getting it on and off the disc and once sending it to the drive and that's actually a lot slower than just going straight from content production to the disc and it really should be powerful you need to be able to not just burn a folder you want to burn exactly the format of data you want you want to be able to really burn anything you know for people that really know what they're doing and want to get down to the guts of it they really should be able to burn anything without having to go out of the way it shouldn't be purely high level it should be accessed down to the low levels so that brings us to diss recording itself so what is disk recording well to begin with it's a device abstraction layer there's lots of devices there's lots of connection interfaces you have USB firewire all these drives you know bae it might behave a little differently underneath the hood but you don't really need to worry about that there's lots of there's lots of things like that so dis recording it's an abstraction layer that makes it very easy to talk to devices this recording is a data streaming engine fundamentally CD burning most CD burning is streaming you start at the beginning and you write all the way to the end and that involves real-time data production it's a content generator again generating the content is not trivially easy if they generate multiple file systems at the same time in or leave them on the disk and if you're burning an audio CD for example then you need to take your mp3 file decompress it you know and send it to the drive and it's a system framework most importantly Apple has already done all of this work we've packages it all up for your application to use the exact same stuff that iTunes the finder all of apple's applications use and it's available for your use so this means for applications that leverage the district reporting services that burning disks is really natural it becomes basically a type of printing for your digital media you produce the content whether it's music whether it's movies scientific data whatever it might be and we get it onto the disk for you so your application is integrated into the digital hub so for those of you who are a little bit familiar with district Corning already we're going to touch upon the new features in Panther so the first thing that's new in cancer is that district ording is now an umbrella framework so we've taken some of the components of dis recording and broken them up into sub frameworks and you might be asking more what does this mean to me really probably not much the only thing that it might I might have to do with you is if you include individual disk recording headers such as be our tracks dot H directly in your application rather than including the framework header so if you include the framework header you're good if you include other headers you might have to update your includes we've got toll-free bridging we have objects in both seeing objective-c and Jaguar there were separate entities and Panther there now exactly the same a dr track ref is the same as the dr track we've got audio file burning so if you're burning an audio CD from mp3's you don't have to write your own mp3 decompressor or figure out how to use quicktime to do it we've got that code for you we've added some pearl audio features media catalog number UPC code the international standard recording code for tracks support for the serial copy management system subtract index points and you can also specify your burn strategy should track it once or session at once and so on we've added carbon accessories for the user interface panels it's got something that we're going to talk about at the end of the session called device profile which is the new way that we're going to be doing device support basically from Panther onward and it's not just it's not just you know and this extra thing that we're giving you it's the way apples going to be doing it too so we're very interested in making it work and making it work right so for those of you that are interested in device profiles will be wanting your feedback at the end of the session and we've added a command line utility give access to some of dis recordings features from the command line so let's dig down a little bit into the API and talk about the general concepts so dis recording is an object-oriented API it's got these high-level objects they're available from both see and objective-c and again new in Panther their toll free bridged so all the see objects are CF types all the objective-c objects are obviously NS objects the see objects you know since they're CF they follow retain release conventions they have CF collection support there's consistent naming conventions between them between the functions in general every object has a property's dictionary and the properties dictionary controls its behavior so rather than having a whole bunch of accessories this is just one dictionary you set properties in it and when it goes to do something it checks the property that's how you control it of course all the API is our thread safe so you don't have to worry about you know calling stuff reentrant lior adding all kinds of extra locks to worry about things everything's thread safe so there are really three main parts to the district court in architecture down at the bottom we have to burn engine and the burn engine is responsible for handling devices or burning and erasing those are its primary features building on top of that we have the content creation AP is and these handle file system creation and in Panther now they handle auto audio track creation from an audio file then parallel to that also building on top of the burn engine we have the user interface so we have panels that you can use for burn setup for progress during a burn and these are really the fundamental tasks this is everything you need to do hopefully except for actually producing your content and we've even got stuff to help you with producing your content so let's zoom in on the burn engine and talk about the objects inside so the burn engine handled for things really I said three before but it's really for angles burning handles are racing they handles devices it'll tell you about devices and you can do certain things to the devices and as part of its device handling it handles media arbitration so the burn engine is what's responsible for helping your application play nice with itunes in the finder and everything else this is all done with really just a small set of objects there's four core objects two of them represent actions to burn in a race object and two of them one of them represents your data and one of them represents the device that you're burning to you can also sign up for notification and so we have our own notification center which we'll cover in just a moment where you can sign up for notifications on your object so the dr burn object represents the act of burning and so you create it and then you ask it to write a layout and what's the layout well layout can be just 1-track if you're perhaps burning a data disk it can be multiple tracks say if you're burning a multitrack audio CD can even be an array of array of tracks in which case you get multiple sessions now burn is an asynchronous operation so you you kick it off and it happens on its own thread and then you get notifications for progress and completion so you don't have to worry about giving it time from your user interface you can do whatever you need to do and it just we take care of it and it just works the our track object it's how you specify the data the dr track object represents your track it could be a CD audio track could be a data track it's flexible we basically expose a lot of MMC down in the dr track so that you can really do anything in MMC you provide your data through a call back and see if the function pointer and Objective C it's a object in the selector and we'll call you back at real time during the burn right when we need the data and obviously you might be doing some sort of computation to produce the data perhaps decompression decrypting whatever so we know that you know the CPU is not infinite so we'll let you will run a production cycle for you so you can find out just how fast you can produce the data so you don't need to do that test yourself we've got already got the helpers in there to help you find the maximum data rate and that helps us set burn speed correctly so that it doesn't under run so we've got the burn object we've got the track which specifies the data now we've got the device object this represents basically where you're burning too so there's one dr device object for every device with burning device that's attached to the system and the dr device objects can report the capabilities of the device which are basically static and unchanging things like this device can write cd-rs this device can write dvd-rs it also can tell you about the media inside the device so that you know you can find out whether the disk inside is blank whether it's already been burned what type it is whether it's CDR dvd-r that sort of thing it's also got a few commands that you can do such as opening and closing the tray on mounting and ejecting volume and dr device will send its own notification and these are a little different so basically crd our device is not something you create it's something that represents devices on the system well we live in a dynamic world and the user can go ahead and plug devices in and pop them out you know at any time with firewire technologies like that so we'll send you a notification when a device shows up we'll send you a notification when a device goes away so you don't have to sit there and keep pulling the list will tell you when it changes we also will tell you when media comes and goes because that's something else that you might need to pull for a while you don't need to pull we all we do it all with notifications and it'll tell you when devices comments come and go when there's when devices are available or not for example if itunes is running and it's doing a burn but you can't really do anything to the device while iTunes is doing a burn so the device goes busy for the duration of that burn then it comes back afterwards and we'll send you a notification when it goes busy we'll send you a notification when it's available again and so to handle all these notifications that I've been talking about we've got the dr Notification Center and if you've used the NS and CF notification centers these are pretty much the same thing have basically the same interface there's a couple detail of the implementation that that differ for one thing the our notification center was designed for inter thread notifications so that we're we're doing the burn up on a high priority real-time thread and we're sending notifications back to you on your main thread so obviously this thread can't the burn thread can't stop and wait for your main thread so the notification center sits in the middle and kind of it alittle straddle things and coalesce multiple notifications into a single one if you if you're updating your UI or whatever else and even though we'll will coalesce some of the notifications we guarantee delivery for all the important ones you know if the burn if we send notifications for one percent two percent three percent complete you can miss one and two as long as you get three percent but if for example to burn finishes well that's you know that's an important notification we guarantee delivery of that one so you can use these notifications to key off the state to understand the state of all the objects so you'll get all the important transitions and this is really strongly recommended sometimes it's easier to write the code that pulls the problem with the polling code is that sometimes you wind up in a state where you know things happen just a little too quickly and you don't pick up what happens on the polling you sign up for notifications will make sure that you get all the notifications you need so we've got our core objects here that we need for a burn let's look at halliburton works so up at the top we've got your application you're going to create a burn object to represent the act of your burn and you're going to associate it with a device you look at the devices on the system pick one and then you set properties on the burn for example whether or not you want to verify the speed at which you want to burn and so on and then you tell the burn to write a layout the layout is down at the bottom in this case it's an array of 3d our tracks so the burn starts to write and as it goes it sends notifications over to the Notification Center Notification Center then relays to your application on main thread or whatever thread you chose and that's basically how the burn works when the burn completes one last notification goes up to your application and then it's done so erasing is really a lot like burning there's not a lot of there's not a lot of surprises here represents an erase rather than a burn again it's an asynchronous operation you start it with one call kick it off goes up happens in the background will send you notifications for progress and when it's done so if we look at the anatomy of an erase it's pretty much the same thing only without the data if your application your race that you step properties on associated with the device notifications go through and get up to your application so we're going to give a little demonstration of how the device notifications work in the burn engine just to give you an example and show you the kinds of things that you can do so let's switch over to demo one okay so what we've got here is we've got a very basic application there's a nib file which will see when it will see when it runs but the nib file basically there's a window with a text field there's nothing complicated in it we've got a pretty empty application controller here so actually I need my script and my scripts gone see if I can get one of my helpers to bring my script up I do know the first several thing so the first thing that we're going to need is we're going to need to include disk recording dot H so we're using the departing services so we're going to include disk recording then once the application is done launching we're going to create we're going to basically create an array which contains a copy of the app of the current devices that are attached and the reason why we're going to do this is because when we call when he asked this recording for the list of devices we're going to get a list of exactly what's connected at that instant but the thing is we can't you can't really rely on that staying the same from one to the net from one moment to the next because devices come and go so if you're going to do something in your UI you need a separate copy that you can say okay I know the third device represents this device because if the second device goes away in between when you ask for the two sets of devices can be a problem so we're going to keep our own local copy of the device list so down here we're going to sign up for a notification we're going to sign up for device disappeared notifications the reason we sign up for disappeared notifications so that we can keep track of we're going to sign up for disappeared before we sign up for up here notifications this is basically for synchronization because this again if a device shows up or if a device disappears once we've built the list then we'll get a notification right away but we don't want to get into any race conditions where we don't find out about a device going away then we're going to add so then we're going to add the device appeared notification so we've now signed up with these two selectors and we've got these methods that are going to be invoked in our app controller well so we're going to need those methods so here's the device appeared and all we're going to do is a standard notification response selector so we get it the object for the notification is the device and we're going to add it to our list so we're going to go and update the user interface so here we go here's the device disappeared notification and again we're just going to get the object for removing from our list and update our UI so this application is basically just going to tell us a little bit about every device connected to the system and it's going to respond dynamically as things come and go so we've been calling update UI so we need to give that an implementation so here's a little bit of stuff to just enumerate the list of our list of devices you know loop through and enumerate the list so we're going to get ice info the device info is static unchanging information about the device describing its capabilities and things like that and part of the info is the devices name and we've got a nice thing that gives you a nicely formatted string describing the device we're going to the connection is also here because the devices for example USB or firewire or whatever else so we're going to get that then we're going to look at the steps and the status is things that can change that so it's the current it's a snapshot of the current status of the device and from that we're going to pull out whether the device is not we're going to pull out the media state when the media state can be empty the in transition which means the drive is spinning up or spinning down or can have media and then we're going to get the media types so if there is media and that's where we get the media type so we're going to get the media info dictionary which is a sub dictionary underneath the status we're going to pull out the media type from the info mediainfo a dictionary if there's no media then we'll have a special string to indicate that and otherwise the media is in transition and spinning up or spinning down so what we're going to do then is we're going to log all of this information that we've gathered basically directly from the device i'm going to log it into the text field i'm going to add it to the text field and set it on the text field so we've just gone through loop through all devices built up this string describing the state of the device and we're done so I think that's it for this one so let's see if it builds so we've got a couple devices connected to the machine over here and these devices we've got two firewire devices plus the internal drive on the machine so when it's ready to go here we go so this is our very simple text field and so we've signed up from the notifications so it's telling us all about each of the things we've got the internal atop e pioneer drive we've got an external drive connected over firewire got another external drive connected over firewire none of them are busy noun for them have any media so I'm going to change that open one stick media in close it are we getting our notification perhaps we're not okay well there might be something wonky with our notifications but we are getting the initial stuff let's try that one more time and just see what happens let's eject this guy if you'll love it no hmm oh did I did not add that you're right that's that's why we're not updating we aren't done with the demo yet so what we need to do is go back over here so we've signed up for device appeared and disappeared notifications but we at what we haven't signed up for is media state changes so let's go up here too so we can detect when devices are there but we're not really noticing what's happening to them so let's go up to device appeared when we give device we're going to sign up from notifications on the media so here we go we're adding another notification again we'll just get the notification center add an observer sign up for device status change notifications a device disappears we're going to go down and remove our remove the notification that we've signed up for so we've just signed up for status changed and you know and removed ourselves so let's go down here glass but not least we need to implement the device state change so when the device state changes all we're going to do is kick over and update the UI so now now that we've got all the code in there let's go ahead and compile it and run it and see if we actually pick up all of the notification so here we go we've got our three drive is that the firewire drive or to fire or drives one of them has a CD in it one of them doesn't so let's put something in the bottom drive so it's in transition the drive is spinning up detecting whether there's media trying to see what it is and there we go it's notice that there's CDR media these drugs might not have functioning eject button so I guess we'll just leave the media in there for now oh its spell checking that's great so okay so we've signed up for notifications and we can watch what's going on on the device now if we were to do a burning iTunes I can would cause it to flip the device busy and so on so you can find out anything you need to about the drive from the notifications and that's it for demo one so let's get back over here to the slides okay great ok so we've talked about the burn engine now we're going to zoom in some of the higher level pieces we're going to talk about content creation content creation is where all the helpers for creating content are so the problem with burning is that you burn basically a data stream and formatting that data stream can be kind of difficult so if you're not up to formatting that data stream we've got helpers to help you do that and make it bring it into a more natural set of AP is so the content creation now with panther has two main parts there's one part that helps you create file systems for data disks including ISO 9660 joliet hfs+ and hybrids of any of those and there's also an audio helper to help you take audio files mp3 AAC files whatever anything QuickTime can import and burn them to an audio CD these are really they're not just you know let's burn one folder they're really pretty powerful pretty flexible and they're easy to use they're very natural concepts as we'll see in just a moment so first we're going to talk about the file systems so the content framework or the content creation API is basically contain things that that cover there's some special kinds of dr tracks there dr tracks where we provide the callback for you and we give the data to the burn engine so dr file system track represents a data track for a CD or dvd and you specify a file system hierarchy that you want on the disk and we'll go ahead and put it on to the disk for you and again this file system hierarchy is not just let's burn a single folder we've got it hooked up so that you can actually do anything you want and the objects are really very natural so we have file and folder objects and so 4dr file objects for example there's different ways to create them you can have them come from an existing file on the hard disk somewhere you can have them come from a data blob in memory or you can specify your own data through a callback routine so if you're getting real-time sampling data you can send it straight to the straight for the drive you have it actually show up as a file rather than just raw data on the disk so the way it works is you build your hierarchy you build a hierarchy of file and folder objects and there's different kinds of objects so your files and folders can they be either real or virtual well let's talk about that distinction for just a moment real files and folders are pretty much copy and straight from an existing file system so if you have you know folder similar or file somewhere this you just want to bring onto the disk you can go ahead and do that you can create a real file that points to that and put it into the hierarchy wherever you want like it doesn't have to be exactly where it was before you you're specifying a brand new hierarchy so we'll pull at stuff from any portion of the disk bring it all together for you objects can also be virtual so they can that means that are entirely created through the API that means they don't exist on disk at all you might be specifying data runtime you might be saying I just want this to be an empty file you can do whatever you want and that's all specified through the API so what we've got we've really got four classes of object we've got real files virtual files real folders and virtual folders now the way the way this works is that three of these are basically you have a hierarchy which is a tree and the leaf nodes three of these are leaf nodes which means that they can't have children added to them so real files in real files and virtual files obviously our files and can't have anything added to them well real folders represent will bring in what's underneath the folder but you can't actually add children to them dynamically so the virtual folders are how you really define your synthetic hierarchy so this cording will take all of this and will generate file systems for you and so these file since we generate have different naming conventions there's ISO 9660 which has one convention joliet which has another hfs+ which has yet another and so the names you know the names can be whatever you want but depending on what names they happen to be they might not conform to what the file system wants the disk recording will automatically transform the file names to make them legal to make them fit so that their they conform to the standards however we don't just be fun we do this automatically but we don't just do it behind your back you know if you need to know that the name of file for example to build a disk relative tasks or something you can actually ask this recording and get the name for each file and you can even change it if you need to if you don't like what this recording is done to it you can go ahead and change it through your UI or programmatically so every object also has the properties dictionary and the properties dictionary for file system objects describes the metadata on the object things like permissions type and creator you know owner group things like that and again since every object has a properties dictionary you can go into the properties dictionary and override the properties on real files real folders virtual files virtual folders you can set all of these and obviously real files and real folders will at first inherits the properties you know the owner group permissions type creator will inherit the properties from the real file but then if you need to you can go in and override those change them whatever you need to do finally each object in the content API s has a mask the mask determines the presence of each object in each file system this is actually it's a very simple concept but at least something pretty cool you can actually take objects and turn them off in specific file systems perhaps you're writing a cross-platform game and you know you have a Windows executable and the mac OS executable well you make the mac OS one only show up in hfs+ filesystem make the windows one only show up in joliet and that's really easy to do and when you set a mask on the root folder that determines it basically carries downward because obviously if a folder doesn't include hfs+ none of its children can really include hrs + either so it carries downward and the way it works is the root is what determines what file systems will be on the disk so if you want a hybrid hybrid disk you set a mask on the root folder that has a hybrid mask and even though we'll put all of these objects in different file systems really a file data is all shared between them you don't have three copies of the file on disk you actually have just one copy and you have essentially three different views of the file data so now we've sort of gone over all that let's look at a real data track so up at the top we've got the dr filesystem track object and it basically just has it does have properties which aren't labeled there but underneath it there are you know our hierarchy our tree of objects so we've got a dr folder which is our root folder it's got a couple files we've got one real file from somewhere on disk and we've got a virtual file that we're going to be specifying the data for at runtime we've got a real folder which automatically brings in everything underneath that folder and then we've got a virtual folder so we've got a couple couple real files another real folder so this recording can take this hierarchy these files these like these real files that are up here the real folders they don't have to be in this tree already it can be anywhere on disk in fact with virtual files they don't have to be on disk at all you can really build a synthetic file system from pretty much anything and its really pretty powerful so that's the file system stuff now new and Panther we have the our audio track dr audio track it's a set of helper api's for creating a red book audio track just a standard audio CD track which you can play in your CD player and it will import any file to quicktime can read so you don't have to write the d compressors you don't have to write stuff to translate it into the CDD a format will do it for you so movies aifs waves mp3's AAC files as quick time moves forward and is able to import more stuff this will be able to import more stuff and again this is a new and Panther so an audio burn an audio track by itself not that exciting so we decided to put a whole audio burn up here so again we have to burn object up at the top with the property and the our audio track again is just a special type of gear track where we provide the callback and we've got a set of files up here so we've got an mp3 file an aiff and an AAC file and when you burn this this recording will just write out a three-track audio CD containing the music from those files so let's talk about the user interface it's the third component the user interface provides a common interface for burning and erasing there are set up panels for setting up a burn and erase and we handle device selection we handle all the logic of keeping track of state changes if the user plugs in a device while the panel's up the panel will notice the user unplugged device all that codes been written so you don't have to do it and we also provide a standard set of options for you know pretty much anything user would want to do for burning and erasing and we also provide standardized progress panels you may have seemed seen them in dis copy and other applications well just pretty much a progress bar keeps track of things be presented as a sheet on your window or as a standalone panel we provide a set of icons if you have to need them for your interface and the user interface is accessible from both coca-cola and carbon and last year we promised that we were going to get it's in carbon we're going to make it available in carbon and it didn't quite make it for the release so here it is for real so we're going to take the content and then DUI I'm going to bring them together and build a pretty full full-featured burning application in just a few lines of code so let's go ahead and switch back to demo one so unfortunately this is not quite as easy as say writing a web browser because we're going to have to actually write some code we can't do it entirely in interface builder yet so what we've got let's go over to demo tube so what we've got for this demo is we've basically got a very very simple app controller we've added a few skeleton methods to pick files you know if you're familiar with NS open panel which you may be then you know this will generally not be a big surprise to you and other than that got this empty user interface with a couple big buttons on it nice big buttons here they are and they don't do much yet so here we are we've got so each of these buttons there's one hooked up to each each of these methods so let's let's go through so go up to the top we're going to include our disk recording headers disk recording you is a separate framework so we're going to import that separately I'm going to go down past the open panels down to here and we're going to go ahead and create an audio disk well how do we create an audio disk well the first thing is we're going to ask the user for some file and once we've got that we're going to loop through the files and enumerate through them we're going to create a dr track for each file and so we're not actually doing error checking here because this is a demo but if we were doing error checking dr the dr track creation method would return nil if clicked on can't read the file so we're going to look at all those then we are going to invoke our methods which we're going to create in just a moment for creating a disc so we're going to burn the layout we've created all the tracks in an array this is the where we're creating the tracks we're going to adult we've added all those to an array and we're going to burn that as a layout so then we're going to go up to here so we've called up this method on ourselves burn layout with description well we need to create that method so what do we do inside that methods well first thing we're going to do is create a set up panel set up channel is you know where the user sets up the burn we've created the setup panel and we're just going to run it there are options you can set on it but we don't really need 70 options we're happy with the default so we're just going to run it and if you use your hits okay well then we're going to go ahead and do the burns and we do the burn by brink by creating a progress panel we're going to put our description into the panel and then we're going to go ahead and tell the panel to start up so it begins the progress channel we get the burn object straight from the setup panel the setup panel pre-configured burn object according to whatever the user has selected so the user says they don't want to verify that's what that property is already set in the burn object and we pass in the layout that came into this method okay and that's actually all we need for burning the layout we're going to run the setup panel we're going to set the description then just start the progress panel so not much code there so we could compile and run and create an audio disk right now but let's go ahead and do the data disc creation so how do we create a data disk well again we're going to call our methods that brings up an open panel select some data files we're going to go through the file we're going to create a virtual folder for now this is a demo we're just going to give it a standard name of our own and take every file the user selects loop through them and look at it figure out whether it's a file or directory and if it's a directory and we create a dr folder this creates a real dr folder otherwise i'm going to create a dr file we're going to take whatever the user selects throw it into one virtual folder at the root of the volume there we go we're going to add it the root folder of the disk and so we've we're setting an explicit filesystem ask here and this controls again which file systems are generated so for example if we wanted a truss the default is actually to create a cross-platform disk which would be hfs+ iso 9660 and joliet if we wanted to we could say okay I don't want I don't want hm s+ we're just going to do an ISO joliet disk you can really pretty much do any combination and we'll just to generate the file systems that you asked for once we've done that we're going to again call our method I'm going to create the track right here gare track to track for root folder boom we've got a file system and we're going to invoke our method to burn that to bring up the bring up the setup panel and do the progress and that's all so let's go ahead and build this so what we've done this with just this little bit of code we've created an application that can burn an audio CD can burn that a data CD and really burn you know pretty much anything you need with just like this little tiny bit of code to select files and bring up the panel so let's run it so here we go here's our interface so we've got our two buttons well let's go ahead and create an audio disc happen to have some music right here let's select the file brings up the burn setup panel so the burn setup panel again you have options to set the speed you have whether to verify or not whether you got to eject your mount after the burn we're just going to leave those pretty much straight forward there's already media loaded in the drive so let's just go ahead and burn so there we go and we're burning an audio CD that was easy well let's go ahead and burn a data CD while we're at it so go over here let's go to Panther developer examples will burn a couple folder sorts of stuff that will burn the disk recording examples too so we've selected three items and what we're what this is going to do is it's going to bring those all together in a virtual folder so again here's our setup panel we're ready to burn there we go so the audio disc is going over here the data disc is building the file systems as we go and you know watching burning happen is a little bit boring but you have to watch the progress bars cross crawl across the screen and there we go we've created an application that can burn audio discs and data discs and it just works which is really pretty cool ok so let's let's switch back to the slides here you go and it really is just that simple that much code burning audio CDs you're burning data cds it's really cool ok so now we're going to talk about device profiles those of you that you know maybe may be involved with creating and bundling hardware you're going to be interested in this so this is something that so this is the new way that device support is going to work an apple is adopting this for ourselves and we're giving this to you for you to hook into so let's talk about what twice profiles are so device profiles are a way for manufacturers bundlers of drives to add support for their own drive without or with reduced interaction from Apple so if you've if you've been in this situation you kind of know what it has to happen you have to send drives in and you have to wait and then we have to do the work and you have to wait and you know it's no fun for you it's no fun for us and we kind of want to make it a lot easier and a lot smoother so what we're going to do is a device profile is a text file and it's an XML plist file that lives on the hard drive it contains two sets of things if you're familiar with kernel extensions it's very similar to the way them the way to the way that works and that there's a dictionary describing the matching and that's all the personality for the profile and then after we've got matching criteria we've got the actual data for the profile in each file we've got information on how the device interprets the NMC specifications if they're you know happened to be any bugs god forbid or quirks in the firmware is there occasionally our it's one point o wasn't quite perfect but the drive got released any way you can you can mark what's broken and still get it to work if there are any quirks such as you know we'll try to ask the dr what it supports but if the drive doesn't support it correctly or dis recording can't quite figure out what's going on then you can help us along by telling us in the profile what the tries does and doesn't do so device profile editor is an application that's going to be released that creates these profile files there you and even though they're p lists we want we want you to use the device profile editor because you know the format is a pretty complicated view list and we don't want to have any mistakes you don't have to dig in there with property list editor where you're going to get this nice UI and the device profile editor will be responsible for validating profiles it'll when you tell when you tell us like what the garage supports we're going to run a battery of tests against the drive make sure that disk recording really can talk to the device so it kind of eliminates a lot of the testing makes it automatic gets rid of some of the support hassles and this is going to be a requirement for you know official support so without further ado let's do a demo of the device profile editor switch back over to demo one and here it is here's the device profile editor so we're a vendor say where they were example CO and we're working on a CD RW 9000 well if we've if we've shipped that under any other vendor names perhaps generic or perhaps we've shipped it with no vendor name at all then you can indicate that here you can pretty much list any of the alternate Thunder names that you may have rebranded the dr.s now we've got the basic feature support in general dis recording will try to use MMC and auto detect all of this stuff but occasionally there's something that drives does or doesn't do that you know dis recording won't be able to automatically sense so you leave everything on auto auto sense in fact for the CD RW 9000 we'll just say that will leave everything autosense and we'll run the tests and if it works then great so the one thing that we do need down here is if the device this recording has a couple things you know all sony drives have a couple characteristics in common all pioneer drives have a couple characteristics in common we know a little bit about draws from various vendors so if there's a device that's from a particular vendor you know it helps to know that so you can put the actual vendor name in here and that helps dis recording a little bit for example if you've rear-ended the drive you can tell us who it actually comes from and then we'll make sure we get the right stuff in there so various thing is if you happen to know that you know there's some drives that can't handle particular cdb commands if that happens then then you can go ahead and exclude them and tell just recording never send this command because the drive might hang the bus or otherwise ledge if we have you know different options parameters that drives can't have handle if their CD burns speeds that can't handle or if you want to enumerate just a good CD the good speeds you can include them and so you'll create the profile with this you can actually create more than one so let's go ahead and create an one again this is example co cd-rw 5000 let's say the crw 5000 an older drive it might report that it does session at once but you know it's kind of broken and this recording can't really talk to it very well so we're going to disable session at once and perhaps it doesn't report DVD support correctly well we'll disable all the DVD burning too and then you can run your battery of tests against this and again if it all works and it passes and you can it'll create a file a dr profile file which you can save so that's our example to drive support and we can install that it with an installer or even have the user do it themselves and then dis recording will be able to burn to that tries again this is a panther thing so new and cancer and we're still kind of working on it so we would really like feedback on how it all works ok so we're we're running just a little bit over so let's kick back to the slides alright so if you're interested in the device profile editor come up to us after the session give us your card will get you on a list and we'll see that to you and it's ready for actual testing and we'll get you on a list for feedback so developer resources we've got a lot of sample code in both see and objective-c the sample code covers audio and data burning erasing we're going to try to get we've got some new sample code and we're going to try to get the demos that we just did up on up a sample code and so there's the URL to the sample code we stop we've also got a public mailing list in which can get on ask your questions it's good to ask your questions in public because someone else may have already had the problem you're having or someone else may encounter in the future and it's all archived so people can search the archives and get help that way so we've got a documentation disk recording services and it's a belief it's also under cocoa where we're kind of technology as both carbon and cocoa so this path says that we're in carbon but also on connect at apple com we've got some new reference documentation for Panther only and that's under connect apple com because it's under its cancer and it's under NDA for now so I'm going to bring Patrick's back up to do the wrap up to follow up as a druid mentioning that we do want to get all your feedback so the contact information up above will be the best way to do that and primarily go through me and then I can disseminate it to the appropriate engineers and keep everything in order but this is something we're really excited about with panther and anyone that has to go through the process of giving guys certified will see all the benefits so anyway so there's a few sessions that you might be interested in as well audio formats today at five Coco inner user interface programming tomorrow quicktime and intense cds which is thursday at ten thirty and righted writing threaded applications so if you want to stay on the subject please attend those