Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining a DVD drive's region code in OS X in C WITHOUT requiring that a DVD be in the drive

Tags:

macos

dvd

Basically I run a network of computers and need to know what region code the drives of the various computers are set to. I don't need to change the region, but I have no idea how to determine the region without going to each computer individually and sticking in a disc. I tried using Apple's cocoa DVD playback framework, but that requires that a disk be inserted into the drive, which sort of defeats the purpose.

So are there any APIs that I can use to determine the region code on a Mac Pro's DVD drive without requiring that a disc be inserted? I am willing to code in pretty much any language.

Thanks

like image 738
user439407 Avatar asked Dec 01 '11 14:12

user439407


People also ask

How do I change the region code on my computer DVD Player?

In the Device Manager window, double-click the DVD/CDROM drives icon. In the Device Properties window, click to select the DVD Region tab. In the DVD Region window, click to select the appropriate region code. Click the OK button.

How can I make my Mac DVD Player region free?

The solution is use VLC (Video LAN Client) instead of Apple's DVD Player. To make this work you must go into System Preferences for DVD Movie and either set VLC as the default application or set it to ignore. This will cause OS X to think of the non-Region 1 DVD as a data disk and mount it in the Finder.


1 Answers

I found some utilities that are capable of dealing with DVD region settings on OS X: DVD Info X, and Region X. DVD Info X will display the region code of your drive without requiring to have a DVD inserted.

Region X is more interesting because although it doesn't directly serve your purpose, its source is available. Looking at it I found that the ScanAll method in Region X.m is what you need. More specifically, the interesting case is the one where the disk name isn't found (because there's no disk mounted) and a SCSI command is used to find out the DVD drive's properties (the printf calls are my addition):

task = (*scsitaskinterface)->CreateSCSITask(scsitaskinterface);
if (task)
{
    cdb[0] = 0xa4;
    cdb[1] = 0x00;
    cdb[2] = 0x00;
    cdb[3] = 0x00;
    cdb[4] = 0x00;
    cdb[5] = 0x00;
    cdb[6] = 0x00;
    cdb[7] = 0x00;
    cdb[8] = (sizeof(DVDInfo) >> 8) & 0xff;
    cdb[9] = sizeof(DVDInfo) & 0xff;
    cdb[10] = 0x08;
    cdb[11] = 0x00;
    memset(&DVDInfo, 0, sizeof(DVDInfo));
    ProcessCDB(task, cdb, 12, DirIn, &DVDInfo, sizeof(DVDInfo), 30000);

    printf("drive region %#hhx\n", DVDInfo.driveRegion);
    printf("number of region changes left: %hhu\n", DVDInfo.numberUserResets);

    if (DVDInfo.rpcScheme == 0) RPC1++;
    if (DVDInfo.rpcScheme != 0) RPC2++;

    (*task)->Release(task);
}

I ran this on my Macbook Pro and the result was as expected.

Obviously you'll need to massage it in order to isolate that part into something you can use, but I think that this code will be a useful starting point.

like image 111
NicolasP Avatar answered Oct 05 '22 02:10

NicolasP