Search
lxdream.org :: lxdream/src/gdrom/gdrom.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.h
changeset 837:4eae2ddccf9c
prev782:1af8b5ce627c
next1023:264e2fd90be8
author nkeynes
date Thu Aug 28 01:39:51 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Extract the disc title (where available) and display in the title bar
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * This file defines the public structures and functions exported by the 
     5  * GD-Rom subsystem
     6  *
     7  * Copyright (c) 2005 Nathan Keynes.
     8  *
     9  * This program is free software; you can redistribute it and/or modify
    10  * it under the terms of the GNU General Public License as published by
    11  * the Free Software Foundation; either version 2 of the License, or
    12  * (at your option) any later version.
    13  *
    14  * This program is distributed in the hope that it will be useful,
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  * GNU General Public License for more details.
    18  */
    20 #ifndef lxdream_gdrom_H
    21 #define lxdream_gdrom_H 1
    23 #include "lxdream.h"
    24 #include "hook.h"
    25 #include <glib/glist.h>
    27 #ifdef __cplusplus
    28 extern "C" {
    29 #endif
    31 typedef uint16_t gdrom_error_t;
    34 struct gdrom_device {
    35     char *name;  // internal name
    36     char *device_name; // Human-readable device name
    37 };
    39 typedef struct gdrom_device *gdrom_device_t;
    41 typedef struct gdrom_disc *gdrom_disc_t;
    43 typedef gboolean (*gdrom_disc_change_hook_t)( gdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
    44 DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);
    46 typedef gboolean (*gdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
    47 DECLARE_HOOK(gdrom_drive_list_change_hook, gdrom_drive_list_change_hook_t);
    49 /**
    50  * Open an image file
    51  */
    52 gdrom_disc_t gdrom_image_open( const gchar *filename );
    54 /**
    55  * Read image bootstrap info
    56  */
    57 gboolean gdrom_image_read_info( gdrom_disc_t d );
    60 /**
    61  * Shortcut to open and mount an image file
    62  * @return true on success
    63  */
    64 gboolean gdrom_mount_image( const gchar *filename );
    66 void gdrom_mount_disc( gdrom_disc_t disc );
    68 void gdrom_unmount_disc( void );
    70 gboolean gdrom_is_mounted( void );
    72 gdrom_disc_t gdrom_get_current_disc();
    74 const gchar *gdrom_get_current_disc_name();
    76 const gchar *gdrom_get_current_disc_title();
    78 uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,
    79                              int mode, unsigned char *buf, uint32_t *length );
    82 /**
    83  * Retrieve the disc table of contents, and write it into the buffer in the 
    84  * format expected by the DC.
    85  * @return 0 on success, error code on failure (eg no disc mounted)
    86  */
    87 gdrom_error_t gdrom_get_toc( unsigned char *buf );
    89 /**
    90  * Retrieve the short (6-byte) session info, and write it into the buffer.
    91  * @return 0 on success, error code on failure.
    92  */
    93 gdrom_error_t gdrom_get_info( unsigned char *buf, int session );
    95 /**
    96  * Native CD-ROM API - provided by drivers/cd_*.c
    97  *
    98  * A device name is either a system special file (most unixes) or a url of the
    99  * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
   100  * defined string that uniquely identifies a particular device.
   101  */
   103 /**
   104  * Return a list of gdrom_device_t defining all CD/DVD drives in the host system.
   105  */
   106 GList *cdrom_get_native_devices();
   108 /**
   109  * Open a native device given a device name and url method. Eg, for the url dvd://1
   110  * this function will be invoked with method = "dvd" and name = "1"
   111  * 
   112  * @return NULL on failure, otherwise a valid gdrom_disc_t that can be mounted.
   113  */
   114 gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *name );
   116 #ifdef __cplusplus
   117 }
   118 #endif
   120 #endif /* !lxdream_gdrom_H */
.