diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-05-07 01:31:44 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-05-07 01:31:44 +0000 |
commit | 572a39455ef8eeef47bf640488ed963ae55925e0 (patch) | |
tree | 3bca377515b7a7381b84a238bd6d3d2374558592 /src | |
parent | a3801dae20515db5ba2da755a99b5470df9e8c5d (diff) | |
download | xine-lib-572a39455ef8eeef47bf640488ed963ae55925e0.tar.gz xine-lib-572a39455ef8eeef47bf640488ed963ae55925e0.tar.bz2 |
Add new mrl_t **get_dir functionality. Fix crash if audio driver == NULL.
CVS patchset: 67
CVS date: 2001/05/07 01:31:44
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_dvd.c | 54 | ||||
-rw-r--r-- | src/input/input_file.c | 288 | ||||
-rw-r--r-- | src/input/input_net.c | 12 | ||||
-rw-r--r-- | src/input/input_plugin.h | 47 | ||||
-rw-r--r-- | src/input/input_rtp.c | 11 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 14 | ||||
-rw-r--r-- | src/input/input_vcd.c | 42 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 13 |
8 files changed, 402 insertions, 79 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 56d714903..158ded44f 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.4 2001/05/06 02:37:59 f1rmb Exp $ + * $Id: input_dvd.c,v 1.5 2001/05/07 01:31:44 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -72,8 +72,11 @@ typedef struct { */ #define MAX_DIR_ENTRIES 250 - char *filelist[MAX_DIR_ENTRIES]; - char *filelist2[MAX_DIR_ENTRIES]; + char *filelist[MAX_DIR_ENTRIES]; + char *filelist2[MAX_DIR_ENTRIES]; + + mrl_t *mrls[MAX_DIR_ENTRIES]; + int mrls_allocated_entries; } dvd_input_plugin_t; @@ -152,7 +155,7 @@ static int openDVDFile (dvd_input_plugin_t *this, * */ static uint32_t dvd_plugin_get_capabilities (input_plugin_t *this) { - return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK | INPUT_CAP_AUTOPLAY; + return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK | INPUT_CAP_AUTOPLAY | INPUT_CAP_GET_DIR; } /* @@ -397,8 +400,8 @@ static char *dvd_plugin_get_identifier (input_plugin_t *this_gen) { /* * */ -static char **dvd_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nEntries) { +static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen, + char *filename, int *nEntries) { dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen; int i, fd; @@ -424,7 +427,9 @@ static char **dvd_plugin_get_dir (input_plugin_t *this_gen, if (!strcasecmp (&this->filelist[i][nLen-4], ".VOB")) { - sprintf (this->filelist2[nFiles2], "dvd://%s", this->filelist[i]); + sprintf (this->mrls[nFiles2]->filename, + "dvd://%s", this->filelist[i]); + this->mrls[nFiles2]->type = mrl_dvd; nFiles2++; } @@ -440,7 +445,7 @@ static char **dvd_plugin_get_dir (input_plugin_t *this_gen, return NULL; } - return this->filelist2; + return this->mrls; } /* @@ -495,6 +500,27 @@ static char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } + +static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + /* + switch(data_type) { + + case INPUT_OPTIONAL_DATA_CLUT: + ... + return INPUT_OPTIONAL_SUCCESS; + break; + + case INPUT_OPTIONAL_DATA_AUDIOLANG: + ... + return INPUT_OPTIONAL_SUCCESS; + break; + + } + */ + return INPUT_OPTIONAL_UNSUPPORTED; +} + /* * */ @@ -510,10 +536,14 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this = (dvd_input_plugin_t *) malloc (sizeof (dvd_input_plugin_t)); for (i = 0; i < MAX_DIR_ENTRIES; i++) { - this->filelist[i] = (char *) malloc (256); - this->filelist2[i] = (char *) malloc (256); + this->filelist[i] = (char *) malloc (256); + this->filelist2[i] = (char *) malloc (256); + this->mrls[i] = (mrl_t *) malloc(sizeof(mrl_t)); + this->mrls[i]->filename = (char *) malloc (256); } - + + this->mrls_allocated_entries = MAX_DIR_ENTRIES; + this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = dvd_plugin_get_capabilities; this->input_plugin.open = dvd_plugin_open; @@ -530,7 +560,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.get_dir = dvd_plugin_get_dir; this->input_plugin.get_mrl = dvd_plugin_get_mrl; this->input_plugin.get_autoplay_list = dvd_plugin_get_autoplay_list; - this->input_plugin.get_clut = NULL; + this->input_plugin.get_optional_data = dvd_plugin_get_optional_data; // this->fh = -1; this->mrl = NULL; diff --git a/src/input/input_file.c b/src/input/input_file.c index aef614ec8..0c56efa7c 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.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_file.c,v 1.8 2001/05/05 23:44:33 f1rmb Exp $ + * $Id: input_file.c,v 1.9 2001/05/07 01:31:44 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -26,30 +26,66 @@ #include <stdio.h> #include <stdlib.h> +#include <dirent.h> +#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <string.h> +#include <errno.h> #include "xine_internal.h" #include "monitor.h" #include "input_plugin.h" +extern int errno; + static uint32_t xine_debug; -typedef struct file_input_plugin_s { - input_plugin_t input_plugin; +#ifndef S_ISLNK +#define S_ISLNK(mode) 0 +#endif +#ifndef S_ISFIFO +#define S_ISFIFO(mode) 0 +#endif +#ifndef S_ISSOCK +#define S_ISSOCK(mode) 0 +#endif +#ifndef S_ISCHR +#define S_ISCHR(mode) 0 +#endif +#ifndef S_ISBLK +#define S_ISBLK(mode) 0 +#endif +#ifndef S_ISREG +#define S_ISREG(mode) 0 +#endif +#if !S_IXUGO +#define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +typedef struct { + input_plugin_t input_plugin; - int fh; - char *mrl; - config_values_t *config; + int fh; + char *mrl; + config_values_t *config; + + mrl_t **mrls; + int mrls_allocated_entries; + } file_input_plugin_t; +/* + * + */ static uint32_t file_plugin_get_capabilities (input_plugin_t *this_gen) { -#warning "remove AUTOPLAY capability." - return INPUT_CAP_SEEKABLE | INPUT_CAP_AUTOPLAY; + return INPUT_CAP_SEEKABLE | INPUT_CAP_GET_DIR; } +/* + * + */ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) { char *filename; @@ -73,12 +109,17 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) { return 1; } - +/* + * + */ static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return read (this->fh, buf, len); } +/* + * + */ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { off_t num_bytes, total_bytes; @@ -102,21 +143,27 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf return buf; } - +/* + * + */ static off_t file_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return lseek (this->fh, offset, origin); } - +/* + * + */ static off_t file_plugin_get_current_pos (input_plugin_t *this_gen){ file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return lseek (this->fh, 0, SEEK_CUR); } - +/* + * + */ static off_t file_plugin_get_length (input_plugin_t *this_gen) { struct stat buf ; @@ -129,28 +176,173 @@ static off_t file_plugin_get_length (input_plugin_t *this_gen) { return 0; } +/* + * + */ static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { return 0; } -static char **file_plugin_get_dir (input_plugin_t *this_gen, char *filename, int *nFiles) { - /* not yet implemented */ +/* + * + */ +static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, + char *filename, int *nFiles) { + file_input_plugin_t *this = (file_input_plugin_t *) this_gen; + char current_dir[PATH_MAX + 1]; + char *fullpathname = NULL; + struct dirent *pdirent; + DIR *pdir; + mode_t mode; + struct stat stat; + int num_files = 0; + + *nFiles = 0; + memset(¤t_dir, 0, strlen(current_dir)); + + /* + * No origin location, so got the content of the current directory + */ + if(!filename) { + char *pwd; + + if((pwd = getenv("PWD")) == NULL) + snprintf(current_dir, 1, "%s", "."); + else + snprintf(current_dir, PATH_MAX, "%s", pwd); + } + else + snprintf(current_dir, PATH_MAX, "%s", filename); + + /* + * Ooch! + */ + if((pdir = opendir(current_dir)) == NULL) { + return NULL; + } + + + while((pdirent = readdir(pdir)) != NULL) { + /* + * full pathname creation + */ + if(!fullpathname) { + fullpathname = (char *) + malloc((strlen(current_dir) + strlen(pdirent->d_name) + 2)); + } + else { + fullpathname = (char *) + realloc(fullpathname, + (strlen(current_dir) + strlen(pdirent->d_name) + 2)); + } + + sprintf(fullpathname, "%s/%s", current_dir, pdirent->d_name); + + /* + * stat the file + */ + if(lstat(fullpathname, &stat) < 0) { + fprintf(stderr, "lstat() failed: %s\n", strerror(errno)); + free(fullpathname); + return NULL; + } + + /* + * alloc enought memory in private plugin structure to + * store found mrls. + */ + if(num_files > this->mrls_allocated_entries + || this->mrls_allocated_entries == 0) { + this->mrls[num_files] = (mrl_t *) malloc(sizeof(mrl_t)); + + this->mrls[num_files]->filename = (char *) + malloc(strlen(pdirent->d_name + 1)); + } + else + this->mrls[num_files]->filename = (char *) + realloc(this->mrls[num_files]->filename, strlen(pdirent->d_name + 1)); + + strcpy(this->mrls[num_files]->filename, pdirent->d_name); + + /* + * Ok, now check file type + */ + mode = stat.st_mode; + + if(S_ISLNK(mode)) { + this->mrls[num_files]->type = mrl_symbolic_link; + /* + * So follow the link + */ + { + char *linkbuf; + int linksize; + + linkbuf = (char *) alloca(PATH_MAX + 2); + memset(linkbuf, 0, sizeof(linkbuf)); + linksize = readlink(fullpathname, linkbuf, PATH_MAX + 1); + + if(linksize < 0) { + fprintf(stderr, "readlink() failed: %s\n", strerror(errno)); + } + else { + this->mrls[num_files]->filename = (char *) + realloc(this->mrls[num_files]->filename, (linksize + 1)); + memset(this->mrls[num_files]->filename, 0, linksize + 1); + strncpy(this->mrls[num_files]->filename, linkbuf, linksize); + } + } + } + else if(S_ISDIR(mode)) + this->mrls[num_files]->type = mrl_directory; + else if(S_ISCHR(mode)) + this->mrls[num_files]->type = mrl_chardev; + else if(S_ISBLK(mode)) + this->mrls[num_files]->type = mrl_blockdev; + else if(S_ISFIFO(mode)) + this->mrls[num_files]->type = mrl_fifo; + else if(S_ISSOCK(mode)) + this->mrls[num_files]->type = mrl_sock; + else { + this->mrls[num_files]->type = mrl_normal; + if(mode & S_IXUGO) + this->mrls[num_files]->type |= mrl_type_exec; + } + + num_files++; + } - printf ("input_file : get_dir () not implemented yet!\n"); + closedir(pdir); + + *nFiles = num_files; + + if(num_files > this->mrls_allocated_entries) + this->mrls_allocated_entries = num_files; - return NULL; + free(fullpathname); + + return this->mrls; } +/* + * + */ static int file_plugin_eject_media (input_plugin_t *this_gen) { return 1; /* doesn't make sense */ } +/* + * + */ static char* file_plugin_get_mrl (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return this->mrl; } +/* + * + */ static void file_plugin_close (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; @@ -160,16 +352,32 @@ static void file_plugin_close (input_plugin_t *this_gen) { this->fh = -1; } - +/* + * + */ static char *file_plugin_get_description (input_plugin_t *this_gen) { return "plain file input plugin as shipped with xine"; } - +/* + * + */ static char *file_plugin_get_identifier (input_plugin_t *this_gen) { return "file"; } +/* + * + */ +static int file_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + + return INPUT_OPTIONAL_UNSUPPORTED; +} + +/* + * + */ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { file_input_plugin_t *this; @@ -180,27 +388,28 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { case 1: this = (file_input_plugin_t *) malloc (sizeof (file_input_plugin_t)); - this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; - this->input_plugin.get_capabilities = file_plugin_get_capabilities; - this->input_plugin.open = file_plugin_open; - this->input_plugin.read = file_plugin_read; - this->input_plugin.read_block = file_plugin_read_block; - this->input_plugin.seek = file_plugin_seek; - this->input_plugin.get_current_pos = file_plugin_get_current_pos; - this->input_plugin.get_length = file_plugin_get_length; - this->input_plugin.get_blocksize = file_plugin_get_blocksize; - this->input_plugin.get_dir = file_plugin_get_dir; - this->input_plugin.eject_media = file_plugin_eject_media; - this->input_plugin.get_mrl = file_plugin_get_mrl; - this->input_plugin.close = file_plugin_close; - this->input_plugin.get_description = file_plugin_get_description; - this->input_plugin.get_identifier = file_plugin_get_identifier; - this->input_plugin.get_autoplay_list = NULL; - this->input_plugin.get_clut = NULL; - - this->fh = -1; - this->mrl = NULL; - this->config = config; + this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; + this->input_plugin.get_capabilities = file_plugin_get_capabilities; + this->input_plugin.open = file_plugin_open; + this->input_plugin.read = file_plugin_read; + this->input_plugin.read_block = file_plugin_read_block; + this->input_plugin.seek = file_plugin_seek; + this->input_plugin.get_current_pos = file_plugin_get_current_pos; + this->input_plugin.get_length = file_plugin_get_length; + this->input_plugin.get_blocksize = file_plugin_get_blocksize; + this->input_plugin.get_dir = file_plugin_get_dir; + this->input_plugin.eject_media = file_plugin_eject_media; + this->input_plugin.get_mrl = file_plugin_get_mrl; + this->input_plugin.close = file_plugin_close; + this->input_plugin.get_description = file_plugin_get_description; + this->input_plugin.get_identifier = file_plugin_get_identifier; + this->input_plugin.get_autoplay_list = NULL; + this->input_plugin.get_optional_data = file_plugin_get_optional_data; + + this->fh = -1; + this->mrl = NULL; + this->config = config; + this->mrls_allocated_entries = 0; return (input_plugin_t *) this; break; @@ -214,4 +423,3 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { return NULL; } } - diff --git a/src/input/input_net.c b/src/input/input_net.c index 4d1a11e91..ddd651053 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -26,6 +26,7 @@ #endif #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> @@ -272,6 +273,15 @@ static char* net_plugin_get_mrl (input_plugin_t *this_gen) { /* * */ +static int net_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + + return INPUT_OPTIONAL_UNSUPPORTED; +} + +/* + * + */ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { net_input_plugin_t *this; @@ -298,7 +308,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.get_description = net_plugin_get_description; this->input_plugin.get_identifier = net_plugin_get_identifier; this->input_plugin.get_autoplay_list = NULL; - this->input_plugin.get_clut = NULL; + this->input_plugin.get_optional_data = net_plugin_get_optional_data; this->fh = -1; this->mrl = NULL; diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index c9d01b71d..58c304b68 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -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_plugin.h,v 1.5 2001/05/06 02:37:59 f1rmb Exp $ + * $Id: input_plugin.h,v 1.6 2001/05/07 01:31:44 f1rmb Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -40,6 +40,30 @@ typedef struct { /* CLUT == Color LookUp Table */ } __attribute__ ((packed)) clut_t; #endif +#define MAX_MRL_ENTRIES 255 + +/* Types of mrls returned by get_dir() */ +#define mrl_unknown 0x0 +#define mrl_dvd 0x1 +#define mrl_vcd 0x3 +#define mrl_net 0x4 +#define mrl_rtp 0x5 +#define mrl_stdin 0x6 +#define mrl_fifo 0x7 +#define mrl_chardev 0x8 +#define mrl_directory 0x9 +#define mrl_blockdev 0xA +#define mrl_normal 0xB +#define mrl_symbolic_link 0xC +#define mrl_sock 0xD +/* bit for exec file, should be combinated with mrl_normal type*/ +#define mrl_type_exec 0xFFFF8000 + +typedef struct { + char *filename; /* filename without pathname */ + int type; /* match to mrl_type enum */ +} mrl_t; + typedef struct input_plugin_s input_plugin_t; struct input_plugin_s @@ -108,7 +132,7 @@ struct input_plugin_s * ls function * return value: NULL => filename is a file, **char=> filename is a dir */ - char** (*get_dir) (input_plugin_t *this, char *filename, int *nFiles); + mrl_t** (*get_dir) (input_plugin_t *this, char *filename, int *nFiles); /* @@ -153,20 +177,29 @@ struct input_plugin_s /* - * gets the subtitle/menu palette + * Request optional datas from input plugin. */ - clut_t* (*get_clut) (input_plugin_t *this); + int (*get_optional_data) (input_plugin_t *this, void *data, int data_type); + }; /* * possible capabilites an input plugin can have: */ - #define INPUT_CAP_NOCAP 0x00000000 #define INPUT_CAP_SEEKABLE 0x00000001 #define INPUT_CAP_BLOCK 0x00000002 #define INPUT_CAP_AUTOPLAY 0x00000004 -#define INPUT_CAP_BROWSABLE 0x00000008 -#define INPUT_CAP_CLUT 0x00000010 +#define INPUT_CAP_GET_DIR 0x00000008 +#define INPUT_CAP_BROWSABLE 0x00000010 +#define INPUT_CAP_CLUT 0x00000020 +#define INPUT_CAP_AUDIOLANG 0x00000040 + + +#define INPUT_OPTIONAL_UNSUPPORTED 0 +#define INPUT_OPTIONAL_SUCCESS 1 + +#define INPUT_OPTIONAL_DATA_CLUT 1 +#define INPUT_OPTIONAL_DATA_AUDIOLANG 2 #endif diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index ec01a1d26..cd072724b 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -427,6 +427,15 @@ static char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { /* * */ +static int rtp_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + + return INPUT_OPTIONAL_UNSUPPORTED; +} + +/* + * + */ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { rtp_input_plugin_t *this; @@ -469,7 +478,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.get_dir = NULL; this->input_plugin.get_mrl = rtp_plugin_get_mrl; this->input_plugin.get_autoplay_list = NULL; - this->input_plugin.get_clut = NULL; + this->input_plugin.get_optional_data = rtp_plugin_get_optional_data; this->fh = -1; this->mrl = NULL; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 3123d95bd..ebe737cc7 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.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_stdin_fifo.c,v 1.3 2001/05/06 14:25:42 guenter Exp $ + * $Id: input_stdin_fifo.c,v 1.4 2001/05/07 01:31:44 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -25,6 +25,7 @@ #endif #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> @@ -192,6 +193,15 @@ static char *stdin_plugin_get_identifier(input_plugin_t *this_gen) { /* * */ +static int stdin_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + + return INPUT_OPTIONAL_UNSUPPORTED; +} + +/* + * + */ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { stdin_input_plugin_t *this; @@ -218,7 +228,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.get_description = stdin_plugin_get_description; this->input_plugin.get_identifier = stdin_plugin_get_identifier; this->input_plugin.get_autoplay_list = NULL; - this->input_plugin.get_clut = NULL; + this->input_plugin.get_optional_data = stdin_plugin_get_optional_data; this->fh = -1; this->mrl = NULL; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 2698a620a..65cfbd9ac 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.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_vcd.c,v 1.3 2001/05/06 02:37:59 f1rmb Exp $ + * $Id: input_vcd.c,v 1.4 2001/05/07 01:31:44 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -85,6 +85,9 @@ typedef struct { char *filelist[100]; + mrl_t *mrls[100]; + int mrls_allocated_entries; + } vcd_input_plugin_t; @@ -427,7 +430,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, dist %= 75; this->cur_frame = dist + start_msf->frame; - xprintf (VERBOSE|INPUT, "%d => %02d:%02d:%02d\n", offset, + xprintf (VERBOSE|INPUT, "%Ld => %02d:%02d:%02d\n", offset, this->cur_min, this->cur_sec, this->cur_frame); break; @@ -562,7 +565,7 @@ static off_t vcd_plugin_get_current_pos (input_plugin_t *this_gen){ */ static uint32_t vcd_plugin_get_capabilities (input_plugin_t *this_gen) { - return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK | INPUT_CAP_AUTOPLAY; + return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK | INPUT_CAP_AUTOPLAY | INPUT_CAP_GET_DIR; } /* @@ -656,8 +659,8 @@ static char *vcd_plugin_get_identifier (input_plugin_t *this_gen) { /* * */ -static char **vcd_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nEntries) { +static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen, + char *filename, int *nEntries) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int i; @@ -691,11 +694,12 @@ static char **vcd_plugin_get_dir (input_plugin_t *this_gen, /* printf ("%d tracks\n", this->total_tracks); */ for (i=1; i<this->total_tracks; i++) { /* FIXME: check if track 0 contains valid data */ - sprintf (this->filelist[i-1], "vcd://%d",i); - /* printf ("list[%d] : %d %s\n", i, this->filelist[i-1], this->filelist[i-1]); */ + sprintf (this->mrls[i-1]->filename, "vcd://%d",i); + this->mrls[i-1]->type = mrl_vcd; + /* printf ("list[%d] : %d %s\n", i, this->mrls[i-1]->filename); */ } - return this->filelist; + return this->mrls; } /* @@ -750,6 +754,15 @@ static char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { /* * */ +static int vcd_plugin_get_optional_data (input_plugin_t *this_gen, + void *data, int data_type) { + + return INPUT_OPTIONAL_UNSUPPORTED; +} + +/* + * + */ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { vcd_input_plugin_t *this; @@ -761,9 +774,14 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this = (vcd_input_plugin_t *) malloc (sizeof (vcd_input_plugin_t)); - for (i=0; i<100; i++) - this->filelist[i] = (char *) malloc (256); - + for (i = 0; i < 100; i++) { + this->filelist[i] = (char *) malloc (256); + this->mrls[i] = (mrl_t *) malloc(sizeof(mrl_t)); + this->mrls[i]->filename = (char *) malloc (256); + } + + this->mrls_allocated_entries = 100; + this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = vcd_plugin_get_capabilities; this->input_plugin.open = vcd_plugin_open; @@ -780,7 +798,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.get_dir = vcd_plugin_get_dir; this->input_plugin.get_mrl = vcd_plugin_get_mrl; this->input_plugin.get_autoplay_list = vcd_plugin_get_autoplay_list; - this->input_plugin.get_clut = NULL; + this->input_plugin.get_optional_data = vcd_plugin_get_optional_data; this->fd = -1; this->mrl = NULL; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index e8179b5ad..06586e223 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.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: xine.c,v 1.14 2001/05/03 23:26:42 f1rmb Exp $ + * $Id: xine.c,v 1.15 2001/05/07 01:31:44 f1rmb Exp $ * * top-level xine functions * @@ -437,9 +437,14 @@ xine_t *xine_init (vo_driver_t *vo, this->video_out = vo_new_instance (vo, this->metronom); video_decoder_init (this); - this->audio_out = ao; - this->audio_out->connect (this->audio_out, this->metronom); - audio_decoder_init (this); + if(ao) { + this->audio_out = ao; + this->audio_out->connect (this->audio_out, this->metronom); + audio_decoder_init (this); + } + else + this->audio_out = NULL; /* Disabling audio output */ + /* * init SPU decoder |