[vlc-devel] default dvd/vcd/audio cd device (on windows)
Brian Robb
vascy at hotmail.com
Sun Sep 4 16:48:53 CEST 2005
When you do File->Open Disc... the device name is *always* D:
But if you have a second hard-drive, that'll be D: and your cdrom drive will
be E:
(Or if you have a third hard-drive your cdrom drive will be F:, etc...)
This is because D: is hard-coded in vlc_config.h, like so:
#if !defined( WIN32 ) && !defined( UNDER_CE )
# define DVD_DEVICE "/dev/dvd"
# define VCD_DEVICE "/dev/cdrom"
# define CDAUDIO_DEVICE "/dev/cdrom"
#else
# define DVD_DEVICE "D:"
# define VCD_DEVICE "D:"
# define CDAUDIO_DEVICE "D:"
#endif
So I've made it so that it sets the device name as the first cdrom drive it
finds...
Here's what I did:
In gui/wxwidgets/open.cpp, line 1568:
In the OnDiscTypeChange method...
After the lines:
void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
{
char *psz_device = NULL;
Add the lines:
char psz_default_device[3] = {0};
#ifdef WIN32
// find the drive_name for the first cdrom drive, which is probably
"D:"...
// and put the drive_name into psz_default_device...
for (char drive_letter = 'A'; drive_letter <= 'Z'; ++drive_letter) {
char drive_name[3] = {drive_letter, ':', 0};
UINT type = GetDriveType(drive_name);
if (type == DRIVE_CDROM) {
psz_default_device[0] = drive_letter;
psz_default_device[1] = ':';
break;
}
}
#endif
Then change all three occurances of the lines:
if( !b_disc_device_changed )
{
if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
else disc_device->SetValue( wxT("") );
}
To:
if( !b_disc_device_changed )
{
if( strlen(psz_default_device) > 0 ) disc_device->SetValue(
wxL2U(psz_default_device) );
else
if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
else disc_device->SetValue( wxT("") );
}
And it'll then start with the device name as E: (for me atleast) in
windows...
(If you don't have a cdrom it'll default back to the old default device /
old behaviour,
since psz_default_device would be zero length...)
:)
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel
mailing list