Search
lxdream.org :: lxdream/src/drivers/cdrom/drive.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/drive.h
changeset 1097:d4807997e450
next1296:30ecee61f811
author nkeynes
date Sun Jan 31 18:35:06 2010 +1000 (12 years ago)
permissions -rw-r--r--
last change Refactor CDROM host support
- Completely separate GDROM hardware (in gdrom/gdrom.c) from generic CDROM
support (now in drivers/cdrom)
- Add concept of 'sector sources' that can be mixed and matched to create
cdrom discs (makes support of arbitrary disc types much simpler)
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/drivers/cdrom/drive.h Sun Jan 31 18:35:06 2010 +1000
1.3 @@ -0,0 +1,97 @@
1.4 +/**
1.5 + * $Id$
1.6 + *
1.7 + * Host CD/DVD drive support.
1.8 + *
1.9 + * This module supplies functions to enumerate the physical drives in the
1.10 + * host system, and open them as a cdrom disc.
1.11 + *
1.12 + * Note that cdrom_disc_t objects bound to a physical drive may update their
1.13 + * TOC at any time, including setting disc_type to CDROM_DISC_NONE (to indicate
1.14 + * no media present).
1.15 + *
1.16 + * Copyright (c) 2009 Nathan Keynes.
1.17 + *
1.18 + * This program is free software; you can redistribute it and/or modify
1.19 + * it under the terms of the GNU General Public License as published by
1.20 + * the Free Software Foundation; either version 2 of the License, or
1.21 + * (at your option) any later version.
1.22 + *
1.23 + * This program is distributed in the hope that it will be useful,
1.24 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.26 + * GNU General Public License for more details.
1.27 + */
1.28 +
1.29 +#ifndef cdrom_drive_H
1.30 +#define cdrom_drive_H 1
1.31 +
1.32 +#include <glib/glist.h>
1.33 +#include "hook.h"
1.34 +#include "drivers/cdrom/defs.h"
1.35 +
1.36 +#ifdef __cplusplus
1.37 +extern "C" {
1.38 +#endif
1.39 +
1.40 +
1.41 +typedef struct cdrom_drive *cdrom_drive_t;
1.42 +
1.43 +typedef cdrom_disc_t (*cdrom_drive_open_fn_t)(cdrom_drive_t, ERROR *);
1.44 +
1.45 +/**
1.46 + * A cdrom_device is a placeholder for a physical CD/DVD drive in the host
1.47 + * system.
1.48 + */
1.49 +struct cdrom_drive {
1.50 + /**
1.51 + * System name for the device
1.52 + */
1.53 + const char *name;
1.54 + /**
1.55 + * Human-readable name of the device - normally the device's vendor
1.56 + * and product name as returned by an Inquiry request.
1.57 + */
1.58 + const char *display_name;
1.59 +
1.60 + /**
1.61 + * Implementation specific function to open the drive, returning a new
1.62 + * cdrom_disc_t.
1.63 + */
1.64 + cdrom_drive_open_fn_t open;
1.65 +};
1.66 +
1.67 +typedef gboolean (*cdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
1.68 +DECLARE_HOOK(cdrom_drive_list_change_hook, cdrom_drive_list_change_hook_t);
1.69 +
1.70 +
1.71 +/**
1.72 + * Native CD-ROM API - provided by drivers/cd_*.c
1.73 + *
1.74 + * A device name is either a system special file (most unixes) or a url of the
1.75 + * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
1.76 + * defined string that uniquely identifies a particular device.
1.77 + */
1.78 +
1.79 +/**
1.80 + * Return a list of cdrom_drive_t defining all CD/DVD drives in the host system.
1.81 + */
1.82 +GList *cdrom_drive_get_list();
1.83 +
1.84 +/**
1.85 + *
1.86 + */
1.87 +cdrom_drive_t cdrom_drive_find( const char *name );
1.88 +
1.89 +/**
1.90 + * Open a cdrom_drive_t previously obtained from the system.
1.91 + *
1.92 + * @return NULL on failure, otherwise a valid cdrom_disc_t that can be mounted.
1.93 + */
1.94 +cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err );
1.95 +
1.96 +#ifdef __cplusplus
1.97 +}
1.98 +#endif
1.99 +
1.100 +#endif /* !cdrom_drive_H */
.