From bf9e6365dc7ff416ec76b0f47834b80870772b40 Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Mon, 8 Oct 2001 12:52:49 +0000 Subject: On solaris, try to grab the default dvd device from vold supplied environment variables, if available. By adding an "action" line like the one below into /etc/rmmount.conf, xine can now be autostarted on insertion of dvd media on solaris: action cdrom action_dvdvideo.so /tmp/xine/bin/xine -s dvd CVS patchset: 768 CVS date: 2001/10/08 12:52:49 --- src/input/input_dvd.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index ec7bea92c..65d31e06a 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.30 2001/10/06 17:57:52 jkeil Exp $ + * $Id: input_dvd.c,v 1.31 2001/10/08 12:52:49 jkeil Exp $ */ #ifdef HAVE_CONFIG_H @@ -136,6 +136,7 @@ static void closeDrive (dvd_input_plugin_t *this) { #ifdef __sun #include #include +#include /* SCSI mmc3 DVD Commands */ #define GPCMD_READ_DVD_STRUCTURE 0xad @@ -173,6 +174,9 @@ typedef union { } dvd_struct; +/* + * Read DVD "Copyright Structure" from DVD Drive + */ static int dvd_read_copyright(int fd, dvd_struct *s) { @@ -211,6 +215,37 @@ dvd_read_copyright(int fd, dvd_struct *s) return 0; } + + +/* + * Check the environment, if we're running under sun's + * vold/rmmount control. + */ +static void +check_solaris_vold_device(dvd_input_plugin_t *this) +{ + char *volume_device; + char *volume_name; + char *volume_action; + char *device; + struct stat stb; + + if ((volume_device = getenv("VOLUME_DEVICE")) != NULL && + (volume_name = getenv("VOLUME_NAME")) != NULL && + (volume_action = getenv("VOLUME_ACTION")) != NULL && + strcmp(volume_action, "insert") == 0) { + + device = malloc(strlen(volume_device) + strlen(volume_name) + 2); + if (device == NULL) + return; + sprintf(device, "%s/%s", volume_device, volume_name); + if (stat(device, &stb) != 0 || !S_ISCHR(stb.st_mode)) { + free(device); + return; + } + this->device = this->raw_device = device; + } +} #endif /* @@ -749,6 +784,9 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->device = config->lookup_str(config, "dvd_device", DVD); this->raw_device = config->lookup_str(config, "dvd_raw_device", RDVD); +#ifdef __sun + check_solaris_vold_device(this); +#endif this->mrls = (mrl_t **) xmalloc(sizeof(mrl_t)); this->mrls_allocated_entries = 0; -- cgit v1.2.3