/* Close a device */
int PortBurn_CloseDevice(void *handle)
{
   PBHandle *h = (PBHandle *)handle;

   if (!h)
      return pbErrNoHandle;

   if (!h->device)
      return pbErrDeviceNotOpen;

   if (h->burn != NULL) {
      CFRelease(h->burn);
      h->burn = NULL;
   }

   if (h->trackArray) {
      CFRelease(h->trackArray);
      h->trackArray = NULL;
   }
 
   DRDeviceReleaseMediaReservation(h->device);
   CFRelease(h->device);
   h->device = NULL;

   if (h->staging) {
      PortBurn_CleanupStaging(h->staging);
      h->staging = NULL;
   }

   return pbSuccess;
}
/* Close a device */
int PortBurn_CloseDevice(void *handle)
{
   PBHandle *h = (PBHandle *)handle;

   if (h == NULL) {
      return pbErrNoHandle;
   }

   if (h->device == NULL) {
      return pbErrDeviceNotOpen;
   }

   if (h->burn != NULL) {
      DRBurnAbort(h->burn);
      CFRelease(h->burn);
      h->burn = NULL;
   }

   if (h->erase != NULL) {
      CFRelease(h->erase);
      h->erase = NULL;
   }

   if (h->trackArray != NULL) {
      CFRelease(h->trackArray);
      h->trackArray = NULL;
   }

   if (h->staging != NULL) {
      PortBurn_CleanupStaging(h->staging);
      h->staging = NULL;
   }

   DRDeviceReleaseMediaReservation(h->device);

   h->device = NULL;

   h->frac = 0.0;

   h->test = pbTestDefault;
   h->verify = pbVerifyDefault;
   h->underrun = pbUnderrunDefault;
   h->eject = pbEjectDefault;
   h->gapless = pbGaplessDefault;
   h->speed = pbSpeedDefault;

   return pbSuccess;
}
Exemple #3
0
JNIEXPORT void JNICALL Java_jdrlib_JDRDevice_nativeReleaseReservation(JNIEnv *env, jobject obj, jlong dev)
{
	DRDeviceRef device = (DRDeviceRef)(long)dev;
	
	DRDeviceReleaseMediaReservation(device);
}
Exemple #4
0
int main(int argc, char *argv[])
{
#pragma unused(argc, argv)
	DRDeviceRef				device = NULL;
	DRBurnRef				burn = NULL;
	CFArrayRef				trackLayout = NULL;
	
	/* Hello world! */
	printf("Welcome to the audio burn sample code!\n\n");
	
	/* First, let's use DRU to prompt the user to 
	   pick a device. If there's only one device to 
	   choose, the selection is automatic. */
	device = druPromptForDevice(NULL,druFilter_AnyBurner);
	
	/* We know we're going to burn to this device - acquire blank media
		reservations just in case the user inserts something. 
		Just because we ask for a shot at blank media doesn't mean that
		we'll get it. Some other app might not be willing to give 
		up the blank media for our use. */
	DRDeviceAcquireMediaReservation(device);
		
	/* create the AIFF tracks we'll be burning to CD. */
	trackLayout = createTracks();
	
	/* Next, use DRU to prompt the user to insert blank media. */
	druPromptForBlankMediaInDevice(device);
	
	/* Check to see if we have the media reservation. If we don't 
		have it that means that some other application has it and 
		won't give it up. We might not get it if, for instance, if
		the Finder has claimed the media for it's CD proxy and the user
		has placed files onto that proxy image. In this case the 
		Finder wouldn't want to unmount the proxy image since the
		user's intention is to burn that information to the inserted
		disc. */
	if (druMediaIsReserved(device))
	{
		/* We've got blank media, and a folder to burn ... 
		now set up the burn objects. */
		burn = DRBurnCreate(device);
		
		/* Use DRU to run the burn and report progress. */
		druBurn(burn,trackLayout);	
	}
	else
	{
		printf("The media in the selected device is reserved for use by another application.\n");
	}
	
	/* Clean up after ourselves. */
	if (burn != NULL)
		CFRelease(burn);
		
	if (trackLayout != NULL)
		CFRelease(trackLayout);
		
	if (device != NULL)
	{
		DRDeviceReleaseMediaReservation(device);
		CFRelease(device);
	}
	return 0;
}