3 * @brief List of disc drives for VLC media player for Windows
5 /*****************************************************************************
6 * Copyright © 2010 Rémi Denis-Courmont
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
27 #include <vlc_common.h>
28 #include <vlc_services_discovery.h>
29 #include <vlc_plugin.h>
31 static int Open (vlc_object_t
*);
33 VLC_SD_PROBE_HELPER("disc", "Discs", SD_CAT_DEVICES
)
40 set_shortname (N_("Discs"))
41 set_description (N_("Discs"))
42 set_category (CAT_PLAYLIST
)
43 set_subcategory (SUBCAT_PLAYLIST_SD
)
44 set_capability ("services_discovery", 0)
45 set_callbacks (Open
, NULL
)
48 VLC_SD_PROBE_SUBMODULE
53 * Probes and initializes.
55 static int Open (vlc_object_t
*obj
)
57 services_discovery_t
*sd
= (services_discovery_t
*)obj
;
59 LONG drives
= GetLogicalDrives ();
60 char mrl
[12] = "file:///A:/", name
[3] = "A:";
61 TCHAR path
[4] = TEXT("A:\\");
63 for (char d
= 0; d
< 26; d
++)
66 char letter
= 'A' + d
;
68 /* Does this drive actually exist? */
69 if (!(drives
& (1 << d
)))
71 /* Is it a disc drive? */
73 if (GetDriveType (path
) != DRIVE_CDROM
)
76 mrl
[8] = name
[0] = letter
;
77 item
= input_item_NewWithType (mrl
, name
,
78 0, NULL
, 0, -1, ITEM_TYPE_DISC
);
79 msg_Dbg (sd
, "adding %s (%s)", mrl
, name
);
83 services_discovery_AddItem (sd
, item
, _("Local drives"));