summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-07-10 21:07:55 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-07-10 21:07:55 +0000
commit4cc9fd313df701f722a81ad4bb551155415ce5cc (patch)
treecafd04a6191675accbc2d168192eee7169a6056b
parent9125c00c6d1242b911cbf68cdd25114cd9972c8f (diff)
downloadxine-lib-4cc9fd313df701f722a81ad4bb551155415ce5cc.tar.gz
xine-lib-4cc9fd313df701f722a81ad4bb551155415ce5cc.tar.bz2
Fixed get_dir in input plugins. Fixed a strange header inclusion bug
in libw32dll/wine. CVS patchset: 264 CVS date: 2001/07/10 21:07:55
-rw-r--r--Makefile.am8
-rw-r--r--doc/Makefile.am1
-rw-r--r--include/xine.h.tmpl.in121
-rw-r--r--src/Makefile.am8
-rw-r--r--src/audio_out/Makefile.am2
-rw-r--r--src/demuxers/Makefile.am2
-rw-r--r--src/input/Makefile.am2
-rw-r--r--src/input/input_dvd.c61
-rw-r--r--src/input/input_file.c506
-rw-r--r--src/input/input_net.c2
-rw-r--r--src/input/input_plugin.h127
-rw-r--r--src/input/input_rtp.c6
-rw-r--r--src/input/input_stdin_fifo.c4
-rw-r--r--src/input/input_vcd.c63
-rw-r--r--src/libac3/Makefile.am2
-rw-r--r--src/libmpeg2/Makefile.am2
-rw-r--r--src/libmpg123/Makefile.am2
-rw-r--r--src/libspudec/Makefile.am2
-rw-r--r--src/libw32dll/Makefile.am6
-rw-r--r--src/libw32dll/wine/Makefile.am2
-rw-r--r--src/libw32dll/wine/config.h2
-rw-r--r--src/video_out/Makefile.am5
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/load_plugins.c8
24 files changed, 745 insertions, 201 deletions
diff --git a/Makefile.am b/Makefile.am
index 2bafc11c5..731345944 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,13 +16,13 @@ docs:
debug:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) $@) \
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) $@) || exit;\
done;
install-debug: debug
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) $@) \
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) $@) || exit; \
done;
prune-cache:
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 1b34c7b9c..c5a66f068 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -47,6 +47,7 @@ erase-docs:
debug:
+install-debug:
mostlyclean-generic:
-rm -f *~ \#* .*~ .\#*
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in
index 327eeb2c5..cac664dfd 100644
--- a/include/xine.h.tmpl.in
+++ b/include/xine.h.tmpl.in
@@ -29,7 +29,7 @@
\endverbatim
*/
/*
- * $Id: xine.h.tmpl.in,v 1.27 2001/07/10 19:33:05 guenter Exp $
+ * $Id: xine.h.tmpl.in,v 1.28 2001/07/10 21:07:55 f1rmb Exp $
*
*/
@@ -454,26 +454,109 @@ void xine_select_spu_channel (xine_t *this, int channel);
char **xine_get_browsable_input_plugin_ids (xine_t *this) ;
/* 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
+#define mrl_unknown (0 << 0)
+#define mrl_dvd (1 << 0)
+#define mrl_vcd (1 << 1)
+#define mrl_net (1 << 2)
+#define mrl_rtp (1 << 3)
+#define mrl_stdin (1 << 4)
+#define mrl_file (1 << 5)
+#define mrl_file_fifo (1 << 6)
+#define mrl_file_chardev (1 << 7)
+#define mrl_file_directory (1 << 8)
+#define mrl_file_blockdev (1 << 9)
+#define mrl_file_normal (1 << 10)
+#define mrl_file_symlink (1 << 11)
+#define mrl_file_sock (1 << 12)
+#define mrl_file_exec (1 << 13)
+#define mrl_file_backup (1 << 14)
+#define mrl_file_hidden (1 << 15)
+
+/*
+ * Freeing/zeroing all of entries of given mrl.
+ */
+#define MRL_ZERO(m) { \
+ if((m)) { \
+ if((m)->origin) \
+ free((m)->origin); \
+ if((m)->mrl) \
+ free((m)->mrl); \
+ if((m)->link) \
+ free((m)->link); \
+ (m)->origin = NULL; \
+ (m)->mrl = NULL; \
+ (m)->link = NULL; \
+ (m)->type = 0; \
+ (m)->size = (off_t) 0; \
+ } \
+}
+
+/*
+ * Duplicate two mrls entries (s = source, d = destination).
+ */
+#define MRL_DUPLICATE(s, d) { \
+ assert((s) != NULL); \
+ assert((d) != NULL); \
+ \
+ if((s)->origin) { \
+ if((d)->origin) { \
+ (d)->origin = (char *) realloc((d)->origin, strlen((s)->origin) + 1); \
+ sprintf((d)->origin, "%s", (s)->origin); \
+ } \
+ else \
+ (d)->origin = strdup((s)->origin); \
+ } \
+ else \
+ (d)->origin = NULL; \
+ \
+ if((s)->mrl) { \
+ if((d)->mrl) { \
+ (d)->mrl = (char *) realloc((d)->mrl, strlen((s)->mrl) + 1); \
+ sprintf((d)->mrl, "%s", (s)->mrl); \
+ } \
+ else \
+ (d)->mrl = strdup((s)->mrl); \
+ } \
+ else \
+ (d)->mrl = NULL; \
+ \
+ if((s)->link) { \
+ if((d)->link) { \
+ (d)->link = (char *) realloc((d)->link, strlen((s)->link) + 1); \
+ sprintf((d)->link, "%s", (s)->link); \
+ } \
+ else \
+ (d)->link = strdup((s)->link); \
+ } \
+ else \
+ (d)->link = NULL; \
+ \
+ (d)->type = (s)->type; \
+ (d)->size = (s)->size; \
+}
+
+/*
+ * Duplicate two arrays of mrls (s = source, d = destination).
+ */
+#define MRLS_DUPLICATE(s, d) { \
+ int i = 0; \
+ \
+ assert((s) != NULL); \
+ assert((d) != NULL); \
+ \
+ while((s) != NULL) { \
+ d[i] = (mrl_t *) malloc(sizeof(mrl_t)); \
+ MRL_DUPLICATE(s[i], d[i]); \
+ i++; \
+ } \
+}
typedef struct {
- char *mrl; /* <type>://<location */
- int type; /* match to mrl_type enum */
- off_t size; /* size of this source, may be 0 */
+ char *origin; /* Origin of grabbed mrls (eg: path for file plugin */
+ char *mrl; /* <type>://<location> */
+ char *link; /* name of link, if exist, otherwise NULL */
+ uint32_t type; /* match to mrl_type enum */
+ off_t size; /* size of this source, may be 0 */
} mrl_t;
/**
diff --git a/src/Makefile.am b/src/Makefile.am
index c0764a929..966c5d896 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,13 +3,13 @@ SUBDIRS = audio_out video_out input libmpeg2 libspudec demuxers \
libac3 libmpg123 libw32dll xine-engine
debug:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) $@) \
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) $@) || exit; \
done;
install-debug: debug
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) $@) \
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) $@) || exit; \
done;
mostlyclean-generic:
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am
index 5a65135c3..ef0a646c9 100644
--- a/src/audio_out/Makefile.am
+++ b/src/audio_out/Makefile.am
@@ -62,7 +62,7 @@ noinst_HEADERS = audio_oss_out.h audio_alsa_out.h audio_esd_out.h \
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am
index 1df89f6af..e55504f1e 100644
--- a/src/demuxers/Makefile.am
+++ b/src/demuxers/Makefile.am
@@ -54,7 +54,7 @@ uninstall-includeHEADERS:
done
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/input/Makefile.am b/src/input/Makefile.am
index 107e9066e..02ff88580 100644
--- a/src/input/Makefile.am
+++ b/src/input/Makefile.am
@@ -64,7 +64,7 @@ uninstall-includeHEADERS:
debug:
- $(MAKE) CFLAGS="-D_FILE_OFFSET_BITS=64 -Wall -DDEBUG -g -DXINE_COMPILE"
+ @$(MAKE) CFLAGS="-D_FILE_OFFSET_BITS=64 -Wall -DDEBUG -g -DXINE_COMPILE"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index e095e5461..b3aa850a8 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.12 2001/07/01 23:37:04 guenter Exp $
+ * $Id: input_dvd.c,v 1.13 2001/07/10 21:07:55 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -87,8 +87,8 @@ typedef struct {
char *filelist[MAX_DIR_ENTRIES];
char *filelist2[MAX_DIR_ENTRIES];
- mrl_t *mrls[MAX_DIR_ENTRIES];
int mrls_allocated_entries;
+ mrl_t **mrls;
} dvd_input_plugin_t;
@@ -435,7 +435,7 @@ static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen,
if((fd = open(DVD, O_RDONLY|O_NONBLOCK)) > -1) {
int nFiles, nFiles2;
-
+
UDFListDir (fd, "/VIDEO_TS", MAX_DIR_ENTRIES, this->filelist, &nFiles);
nFiles2 = 0;
@@ -450,11 +450,30 @@ static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen,
if (!strcasecmp (&this->filelist[i][nLen-4], ".VOB")) {
char str[1024];
- sprintf (this->mrls[nFiles2]->mrl,
- "dvd://%s", this->filelist[i]);
- this->mrls[nFiles2]->type = mrl_dvd;
+ if(nFiles2 >= this->mrls_allocated_entries
+ || this->mrls_allocated_entries == 0) {
+ this->mrls[nFiles2] = (mrl_t *) xmalloc(sizeof(mrl_t));
+ }
+ else {
+ memset(this->mrls[nFiles2], 0, sizeof(mrl_t));
+ }
+
+ if(this->mrls[nFiles2]->mrl) {
+ this->mrls[nFiles2]->mrl = (char *)
+ realloc(this->mrls[nFiles2]->mrl, strlen(this->filelist[i]) + 7);
+ }
+ else {
+ this->mrls[nFiles2]->mrl = (char *)
+ xmalloc(strlen(this->filelist[i]) + 7);
+ }
+
+ this->mrls[nFiles2]->origin = NULL;
+ sprintf(this->mrls[nFiles2]->mrl, "dvd://%s", this->filelist[i]);
+ this->mrls[nFiles2]->link = NULL;
+ this->mrls[nFiles2]->type = (0 | mrl_dvd);
/* determine size */
+ memset(&str, 0, strlen(str));
sprintf (str, "/VIDEO_TS/%s", this->filelist[i]);
UDFFindFile(fd, str, &this->mrls[nFiles2]->size);
@@ -471,6 +490,21 @@ static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen,
else
return NULL;
+ /*
+ * Freeing exceeded mrls if exists.
+ */
+ if(*nEntries > this->mrls_allocated_entries)
+ this->mrls_allocated_entries = *nEntries;
+ else if(this->mrls_allocated_entries > *nEntries) {
+ while(this->mrls_allocated_entries > *nEntries) {
+ MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]);
+ free(this->mrls[this->mrls_allocated_entries--]);
+ }
+ }
+
+ /*
+ * This is useful to let UI know where it should stops ;-).
+ */
this->mrls[*nEntries] = NULL;
return this->mrls;
@@ -570,17 +604,13 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
}
- this = (dvd_input_plugin_t *) malloc (sizeof (dvd_input_plugin_t));
+ this = (dvd_input_plugin_t *) xmalloc (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->mrls[i] = (mrl_t *) malloc(sizeof(mrl_t));
- this->mrls[i]->mrl = (char *) malloc (256);
+ this->filelist[i] = (char *) xmalloc (256);
+ this->filelist2[i] = (char *) xmalloc (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;
@@ -600,7 +630,10 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.get_optional_data = dvd_plugin_get_optional_data;
this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
-
+
+ this->mrls = (mrl_t **) xmalloc(sizeof(mrl_t));
+ this->mrls_allocated_entries = 0;
+
this->mrl = NULL;
this->config = config;
this->dvd_fd = -1;
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 6a6bbfba9..182c34d5f 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.15 2001/07/01 23:37:04 guenter Exp $
+ * $Id: input_file.c,v 1.16 2001/07/10 21:07:55 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -43,6 +43,8 @@ extern int errno;
static uint32_t xine_debug;
+#define MAXFILES 65535
+
#ifndef S_ISLNK
#define S_ISLNK(mode) 0
#endif
@@ -77,6 +79,151 @@ typedef struct {
} file_input_plugin_t;
+
+/* ***************************************************************************
+ * PRIVATES FUNCTIONS
+ */
+
+/*
+ * Sorting function, it comes from GNU fileutils package.
+ */
+#define S_N 0x0
+#define S_I 0x4
+#define S_F 0x8
+#define S_Z 0xC
+#define CMP 2
+#define LEN 3
+#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+static int strverscmp(const char *s1, const char *s2) {
+ const unsigned char *p1 = (const unsigned char *) s1;
+ const unsigned char *p2 = (const unsigned char *) s2;
+ unsigned char c1, c2;
+ int state;
+ int diff;
+ static const unsigned int next_state[] = {
+ S_N, S_I, S_Z, S_N,
+ S_N, S_I, S_I, S_I,
+ S_N, S_F, S_F, S_F,
+ S_N, S_F, S_Z, S_Z
+ };
+ static const int result_type[] = {
+ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
+ 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
+ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
+ -1, CMP, CMP, CMP
+ };
+
+ if(p1 == p2)
+ return 0;
+
+ c1 = *p1++;
+ c2 = *p2++;
+
+ state = S_N | ((c1 == '0') + (ISDIGIT(c1) != 0));
+
+ while((diff = c1 - c2) == 0 && c1 != '\0') {
+ state = next_state[state];
+ c1 = *p1++;
+ c2 = *p2++;
+ state |= (c1 == '0') + (ISDIGIT(c1) != 0);
+ }
+
+ state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT(c2) != 0))];
+
+ switch(state) {
+ case CMP:
+ return diff;
+
+ case LEN:
+ while(ISDIGIT(*p1++))
+ if(!ISDIGIT(*p2++))
+ return 1;
+
+ return ISDIGIT(*p2) ? -1 : diff;
+
+ default:
+ return state;
+ }
+}
+
+/*
+ * Wrapper to strverscmp() for qsort() calls, which sort mrl_t type array.
+ */
+static int _sortfiles_default(const mrl_t *s1, const mrl_t *s2) {
+ return(strverscmp(s1->mrl, s2->mrl));
+}
+
+/*
+ * Return the type (OR'ed) of the given file *fully named*
+ */
+static uint32_t get_file_type(char *filepathname, char *origin) {
+ struct stat pstat;
+ int mode;
+ uint32_t file_type = 0;
+ char buf[PATH_MAX + NAME_MAX + 1];
+
+ if((lstat(filepathname, &pstat)) < 0) {
+ sprintf(buf, "%s/%s", origin, filepathname);
+ if((lstat(buf, &pstat)) < 0) {
+ printf("lstat failed for %s{%s}\n", filepathname, origin);
+ file_type |= mrl_unknown;
+ return file_type;
+ }
+ }
+
+ file_type |= mrl_file;
+
+ mode = pstat.st_mode;
+
+ if(S_ISLNK(mode))
+ file_type |= mrl_file_symlink;
+ else if(S_ISDIR(mode))
+ file_type |= mrl_file_directory;
+ else if(S_ISCHR(mode))
+ file_type |= mrl_file_chardev;
+ else if(S_ISBLK(mode))
+ file_type |= mrl_file_blockdev;
+ else if(S_ISFIFO(mode))
+ file_type |= mrl_file_fifo;
+ else if(S_ISSOCK(mode))
+ file_type |= mrl_file_sock;
+ else {
+ if(S_ISREG(mode)) {
+ file_type |= mrl_file_normal;
+ }
+ if(mode & S_IXUGO)
+ file_type |= mrl_file_exec;
+ }
+
+ if(filepathname[strlen(filepathname) - 1] == '~')
+ file_type |= mrl_file_backup;
+
+ return file_type;
+}
+
+/*
+ * Return the file size of the given file *fully named*
+ */
+static off_t get_file_size(char *filepathname, char *origin) {
+ struct stat pstat;
+ char buf[PATH_MAX + NAME_MAX + 1];
+
+ if((lstat(filepathname, &pstat)) < 0) {
+ sprintf(buf, "%s/%s", origin, filepathname);
+ if((lstat(buf, &pstat)) < 0)
+ return (off_t) 0;
+ }
+
+ return pstat.st_size;
+}
+/*
+ * END OF PRIVATES
+ *****************************************************************************/
+
/*
*
*/
@@ -186,18 +333,33 @@ static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) {
}
/*
+ * Return 1 is filepathname is a directory, otherwise 0
+ */
+static int is_a_dir(char *filepathname) {
+ struct stat pstat;
+
+ stat(filepathname, &pstat);
+
+ return (S_ISDIR(pstat.st_mode));
+}
+
+/*
*
*/
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 pstat;
- int num_files = 0;
+ mrl_t *hide_files, *dir_files, *norm_files;
+ char current_dir[PATH_MAX + 1];
+ char current_dir_slashed[PATH_MAX + 1];
+ char fullfilename[PATH_MAX + NAME_MAX + 1];
+ int num_hide_files = 0;
+ int num_dir_files = 0;
+ int num_norm_files = 0;
+ int num_files = -1;
+ int (*func) () = _sortfiles_default;
*nFiles = 0;
memset(&current_dir, 0, strlen(current_dir));
@@ -213,126 +375,268 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
else
snprintf(current_dir, PATH_MAX, "%s", pwd);
}
- else
+ else {
+
+ /* Remove exceed '/' */
+ while((filename[strlen(filename) - 1] == '/') && strlen(filename) > 1)
+ filename[strlen(filename) - 1] = '\0';
+
snprintf(current_dir, PATH_MAX, "%s", filename);
+ }
+
+ if(strcasecmp(current_dir, "/"))
+ sprintf(current_dir_slashed, "%s/", current_dir);
+ else
+ sprintf(current_dir_slashed, "/");
+
/*
* Ooch!
*/
- if((pdir = opendir(current_dir)) == NULL) {
- return NULL;
- }
-
+ if((pdir = opendir(current_dir)) == NULL)
+ return NULL;
+
+ dir_files = (mrl_t *) xmalloc(sizeof(mrl_t) * MAXFILES);
+ hide_files = (mrl_t *) xmalloc(sizeof(mrl_t) * MAXFILES);
+ norm_files = (mrl_t *) xmalloc(sizeof(mrl_t) * MAXFILES);
+
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, &pstat) < 0) {
- fprintf(stderr, "lstat() failed: %s\n", strerror(errno));
- free(fullpathname);
- return NULL;
- }
+ memset(&fullfilename, 0, strlen(fullfilename));
+ sprintf(fullfilename, "%s/%s", current_dir, pdirent->d_name);
- /*
- * alloc enought memory in private plugin structure to
- * store found mrls.
- */
- if(num_files >= this->mrls_allocated_entries
- || this->mrls_allocated_entries == 0) {
-
- if((this->mrls[num_files] = (mrl_t *) malloc(sizeof(mrl_t))) == NULL) {
- fprintf(stderr, "malloc() failed: %s\n", strerror(errno));
- return NULL;
+ if(is_a_dir(fullfilename)) {
+
+ dir_files[num_dir_files].mrl = (char *)
+ xmalloc(strlen(current_dir_slashed) + 1 + strlen(pdirent->d_name) + 1);
+
+ dir_files[num_dir_files].origin = strdup(current_dir);
+ sprintf(dir_files[num_dir_files].mrl, "%s%s",
+ current_dir_slashed, pdirent->d_name);
+ dir_files[num_dir_files].link = NULL;
+ dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir);
+ dir_files[num_dir_files].size = get_file_size(fullfilename, current_dir);
+
+ /* The file is a link, follow it */
+ if(dir_files[num_dir_files].type & mrl_file_symlink) {
+ char linkbuf[PATH_MAX + NAME_MAX + 1];
+ int linksize;
+
+ memset(&linkbuf, 0, PATH_MAX + NAME_MAX);
+ linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX);
+
+ if(linksize < 0) {
+ fprintf(stderr, "%s(%d): readlink() failed: %s\n",
+ __FUNCTION__, __LINE__, strerror(errno));
+ }
+ else {
+ dir_files[num_dir_files].link = (char *) xmalloc(linksize + 1);
+ strncpy(dir_files[num_dir_files].link, linkbuf, linksize);
+ dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir);
+ }
}
-
- this->mrls[num_files]->mrl = (char *) malloc(strlen(fullpathname) + 1);
-
- }
+
+ num_dir_files++;
+ } /* Hmmmm, an hidden file ? */
+ else if((strlen(pdirent->d_name) > 1)
+ && (pdirent->d_name[0] == '.' && pdirent->d_name[1] != '.')) {
+
+ hide_files[num_hide_files].mrl = (char *)
+ xmalloc(strlen(current_dir_slashed) + 1 + strlen(pdirent->d_name) + 1);
+
+ hide_files[num_hide_files].origin = strdup(current_dir);
+ sprintf(hide_files[num_hide_files].mrl, "%s%s",
+ current_dir_slashed, pdirent->d_name);
+ hide_files[num_hide_files].link = NULL;
+ hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir);
+ hide_files[num_hide_files].size = get_file_size(fullfilename, current_dir);
+
+ /* The file is a link, follow it */
+ if(hide_files[num_hide_files].type & mrl_file_symlink) {
+ char linkbuf[PATH_MAX + NAME_MAX + 1];
+ int linksize;
+
+ memset(&linkbuf, 0, PATH_MAX + NAME_MAX);
+ linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX);
+
+ if(linksize < 0) {
+ fprintf(stderr, "%s(%d): readlink() failed: %s\n",
+ __FUNCTION__, __LINE__, strerror(errno));
+ }
+ else {
+ hide_files[num_hide_files].link = (char *)
+ xmalloc(linksize + 1);
+ strncpy(hide_files[num_hide_files].link, linkbuf, linksize);
+ hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir);
+ }
+ }
+
+ num_hide_files++;
+ } /* So a *normal* one. */
else {
- printf("realloc\n");
- this->mrls[num_files]->mrl = (char *)
- realloc(this->mrls[num_files]->mrl, strlen(fullpathname) + 1);
- }
-
- sprintf(this->mrls[num_files]->mrl, "%s", fullpathname);
-
- this->mrls[num_files]->size = pstat.st_size;
- /*
- * Ok, now check file type
- */
- mode = pstat.st_mode;
-
- if(S_ISLNK(mode)) {
- this->mrls[num_files]->type = mrl_symbolic_link;
- /*
- * So follow the link
- */
- {
- char *linkbuf;
+ norm_files[num_norm_files].mrl = (char *)
+ xmalloc(strlen(current_dir_slashed) + 1 + strlen(pdirent->d_name) + 1);
+
+ norm_files[num_norm_files].origin = strdup(current_dir);
+ sprintf(norm_files[num_norm_files].mrl, "%s%s",
+ current_dir_slashed, pdirent->d_name);
+ norm_files[num_norm_files].link = NULL;
+ norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir);
+ norm_files[num_norm_files].size = get_file_size(fullfilename, current_dir);
+
+ /* The file is a link, follow it */
+ if(norm_files[num_norm_files].type & mrl_file_symlink) {
+ char linkbuf[PATH_MAX + NAME_MAX + 1];
int linksize;
- linkbuf = (char *) alloca(PATH_MAX + 2);
- memset(linkbuf, 0, sizeof(linkbuf));
- linksize = readlink(fullpathname, linkbuf, PATH_MAX + 1);
+ memset(&linkbuf, 0, PATH_MAX + NAME_MAX);
+ linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "readlink() failed: %s\n", strerror(errno));
+ fprintf(stderr, "%s(%d): readlink() failed: %s\n",
+ __FUNCTION__, __LINE__, strerror(errno));
}
else {
- this->mrls[num_files]->mrl = (char *)
- realloc(this->mrls[num_files]->mrl, (linksize + 1));
- memset(this->mrls[num_files]->mrl, 0, linksize + 1);
- strncpy(this->mrls[num_files]->mrl, linkbuf, linksize);
+ norm_files[num_norm_files].link = (char *)
+ xmalloc(linksize + 1);
+ strncpy(norm_files[num_norm_files].link, linkbuf, linksize);
+ norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir);
}
}
+
+ num_norm_files++;
}
- 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++;
}
-
+
closedir(pdir);
+
+ /*
+ * Ok, there are some files here, so sort
+ * them then store them into global mrls array.
+ */
+ if(num_files > 0) {
+ int i;
- *nFiles = num_files;
+ num_files = 0;
+
+ /*
+ * Sort arrays
+ */
+ if(num_dir_files)
+ qsort(dir_files, num_dir_files, sizeof(mrl_t), func);
+
+ if(num_hide_files)
+ qsort(hide_files, num_hide_files, sizeof(mrl_t), func);
+
+ if(num_norm_files)
+ qsort(norm_files, num_norm_files, sizeof(mrl_t), func);
+
+ /*
+ * Add directories entries
+ */
+ for(i = 0; i < num_dir_files; i++) {
+
+ if(num_files >= this->mrls_allocated_entries
+ || this->mrls_allocated_entries == 0) {
+ this->mrls[num_files] = (mrl_t *) xmalloc(sizeof(mrl_t));
+ }
+ else
+ memset(this->mrls[num_files], 0, sizeof(mrl_t));
+
+ MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]);
+ num_files++;
+ }
+
+ /*
+ * Add hidden files entries
+ */
+ for(i = 0; i < num_hide_files; i++) {
+
+ if(num_files >= this->mrls_allocated_entries
+ || this->mrls_allocated_entries == 0) {
+ this->mrls[num_files] = (mrl_t *) xmalloc(sizeof(mrl_t));
+ }
+ else
+ memset(this->mrls[num_files], 0, sizeof(mrl_t));
+
+ MRL_DUPLICATE(&hide_files[i], this->mrls[num_files]);
+
+ num_files++;
+ }
+
+ /*
+ * Add other files entries
+ */
+ for(i = 0; i < num_norm_files; i++) {
+
+ if(num_files >= this->mrls_allocated_entries
+ || this->mrls_allocated_entries == 0) {
+ this->mrls[num_files] = (mrl_t *) xmalloc(sizeof(mrl_t));
+ }
+ else
+ memset(this->mrls[num_files], 0, sizeof(mrl_t));
+
+ MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]);
+
+ num_files++;
+ }
+
+ /* Some cleanups before leaving */
+ for(i = num_dir_files; i == 0; i--)
+ MRL_ZERO(&dir_files[i]);
+ free(dir_files);
+
+ for(i = num_hide_files; i == 0; i--)
+ MRL_ZERO(&hide_files[i]);
+ free(hide_files);
+
+ for(i = num_norm_files; i == 0; i--)
+ MRL_ZERO(&norm_files[i]);
+ free(norm_files);
+
+ }
+ else
+ return NULL;
+
+ /*
+ * Inform caller about files found number.
+ */
+ *nFiles = num_files;
+
+ /*
+ * Freeing exceeded mrls if exists.
+ */
if(num_files > this->mrls_allocated_entries)
this->mrls_allocated_entries = num_files;
-
- if(fullpathname)
- free(fullpathname);
+ else if(this->mrls_allocated_entries > num_files) {
+ while(this->mrls_allocated_entries > num_files) {
+ MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]);
+ free(this->mrls[this->mrls_allocated_entries--]);
+ }
+ }
+ /*
+ * This is useful to let UI know where it should stops ;-).
+ */
this->mrls[num_files] = NULL;
-
+
+ /*
+ * Some debugging info
+ */
+ /*
+ {
+ int j = 0;
+ while(this->mrls[j]) {
+ printf("mrl[%d] = '%s'\n", j, this->mrls[j]->mrl);
+ j++;
+ }
+ }
+ */
+
return this->mrls;
}
@@ -404,7 +708,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
return NULL;
}
- this = (file_input_plugin_t *) malloc (sizeof (file_input_plugin_t));
+ this = (file_input_plugin_t *) xmalloc (sizeof (file_input_plugin_t));
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = file_plugin_get_capabilities;
@@ -423,14 +727,14 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
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->input_plugin.handle_input_event= NULL;
- this->input_plugin.is_branch_possible= NULL;
+ this->input_plugin.handle_input_event = NULL;
+ this->input_plugin.is_branch_possible = NULL;
this->fh = -1;
this->mrl = NULL;
this->config = config;
- this->mrls = (mrl_t **) malloc(sizeof(mrl_t));
+ this->mrls = (mrl_t **) xmalloc(sizeof(mrl_t));
this->mrls_allocated_entries = 0;
return (input_plugin_t *) this;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 10df55896..3d0e6170b 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -302,7 +302,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
return NULL;
}
- this = (net_input_plugin_t *) malloc (sizeof (net_input_plugin_t));
+ this = (net_input_plugin_t *) xmalloc(sizeof(net_input_plugin_t));
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = net_plugin_get_capabilities;
diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h
index 2c109aa9d..5bcd02a78 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.8 2001/07/01 23:37:04 guenter Exp $
+ * $Id: input_plugin.h,v 1.9 2001/07/10 21:07:55 f1rmb Exp $
*/
#ifndef HAVE_INPUT_PLUGIN_H
@@ -25,6 +25,7 @@
#include <inttypes.h>
#include <sys/types.h>
+#include <assert.h>
#include "buffer.h"
#include "configfile.h"
@@ -40,29 +41,117 @@ typedef struct { /* CLUT == Color LookUp Table */
} __attribute__ ((packed)) clut_t;
#endif
+/*
+ * Return pointer of allocate/cleaned memory size *size*.
+ */
+extern void *xmalloc(size_t);
+
#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
+#define mrl_unknown (0 << 0)
+#define mrl_dvd (1 << 0)
+#define mrl_vcd (1 << 1)
+#define mrl_net (1 << 2)
+#define mrl_rtp (1 << 3)
+#define mrl_stdin (1 << 4)
+#define mrl_file (1 << 5)
+#define mrl_file_fifo (1 << 6)
+#define mrl_file_chardev (1 << 7)
+#define mrl_file_directory (1 << 8)
+#define mrl_file_blockdev (1 << 9)
+#define mrl_file_normal (1 << 10)
+#define mrl_file_symlink (1 << 11)
+#define mrl_file_sock (1 << 12)
+#define mrl_file_exec (1 << 13)
+#define mrl_file_backup (1 << 14)
+#define mrl_file_hidden (1 << 15)
+
+/*
+ * Freeing/zeroing all of entries of given mrl.
+ */
+#define MRL_ZERO(m) { \
+ if((m)) { \
+ if((m)->origin) \
+ free((m)->origin); \
+ if((m)->mrl) \
+ free((m)->mrl); \
+ if((m)->link) \
+ free((m)->link); \
+ (m)->origin = NULL; \
+ (m)->mrl = NULL; \
+ (m)->link = NULL; \
+ (m)->type = 0; \
+ (m)->size = (off_t) 0; \
+ } \
+}
+
+/*
+ * Duplicate two mrls entries (s = source, d = destination).
+ */
+#define MRL_DUPLICATE(s, d) { \
+ assert((s) != NULL); \
+ assert((d) != NULL); \
+ \
+ if((s)->origin) { \
+ if((d)->origin) { \
+ (d)->origin = (char *) realloc((d)->origin, strlen((s)->origin) + 1); \
+ sprintf((d)->origin, "%s", (s)->origin); \
+ } \
+ else \
+ (d)->origin = strdup((s)->origin); \
+ } \
+ else \
+ (d)->origin = NULL; \
+ \
+ if((s)->mrl) { \
+ if((d)->mrl) { \
+ (d)->mrl = (char *) realloc((d)->mrl, strlen((s)->mrl) + 1); \
+ sprintf((d)->mrl, "%s", (s)->mrl); \
+ } \
+ else \
+ (d)->mrl = strdup((s)->mrl); \
+ } \
+ else \
+ (d)->mrl = NULL; \
+ \
+ if((s)->link) { \
+ if((d)->link) { \
+ (d)->link = (char *) realloc((d)->link, strlen((s)->link) + 1); \
+ sprintf((d)->link, "%s", (s)->link); \
+ } \
+ else \
+ (d)->link = strdup((s)->link); \
+ } \
+ else \
+ (d)->link = NULL; \
+ \
+ (d)->type = (s)->type; \
+ (d)->size = (s)->size; \
+}
+
+/*
+ * Duplicate two arrays of mrls (s = source, d = destination).
+ */
+#define MRLS_DUPLICATE(s, d) { \
+ int i = 0; \
+ \
+ assert((s) != NULL); \
+ assert((d) != NULL); \
+ \
+ while((s) != NULL) { \
+ d[i] = (mrl_t *) malloc(sizeof(mrl_t)); \
+ MRL_DUPLICATE(s[i], d[i]); \
+ i++; \
+ } \
+}
typedef struct {
- char *mrl; /* <type>://<location */
- int type; /* match to mrl_type enum */
- off_t size; /* size of this source, may be 0 */
+ char *origin; /* Origin of grabbed mrls (eg: path for file plugin */
+ char *mrl; /* <type>://<location> */
+ char *link; /* name of link, if exist, otherwise NULL */
+ uint32_t type; /* match to mrl_type enum */
+ off_t size; /* size of this source, may be 0 */
} mrl_t;
typedef struct input_plugin_s input_plugin_t;
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index b69eeee03..d46ba2058 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -460,15 +460,15 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
}
- this = (rtp_input_plugin_t *) malloc (sizeof (rtp_input_plugin_t));
+ this = (rtp_input_plugin_t *) xmalloc(sizeof(rtp_input_plugin_t));
for (bufn = 0; bufn < N_BUFFERS; bufn++) {
- input_buffer_t *buf = malloc(sizeof(input_buffer_t));
+ input_buffer_t *buf = xmalloc(sizeof(input_buffer_t));
if (!buf) {
fprintf(stderr, "unable to allocate input buffer.\n");
exit(1);
}
- buf->buf = malloc(IBUFFER_SIZE);
+ buf->buf = xmalloc(IBUFFER_SIZE);
if (!buf->buf) {
fprintf(stderr, "unable to allocate input buffer.\n");
exit(1);
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index b45e3b50f..e5fda5300 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.7 2001/07/01 23:37:04 guenter Exp $
+ * $Id: input_stdin_fifo.c,v 1.8 2001/07/10 21:07:55 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -258,7 +258,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
return NULL;
}
- this = (stdin_input_plugin_t *) malloc (sizeof (stdin_input_plugin_t));
+ this = (stdin_input_plugin_t *) xmalloc(sizeof(stdin_input_plugin_t));
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = stdin_plugin_get_capabilities;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index cd51bc385..ee1ea378e 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.12 2001/07/01 23:37:04 guenter Exp $
+ * $Id: input_vcd.c,v 1.13 2001/07/10 21:07:55 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -104,8 +104,8 @@ typedef struct {
char *filelist[100];
- mrl_t *mrls[100];
int mrls_allocated_entries;
+ mrl_t **mrls;
#if defined(__sun)
int controller_type;
@@ -165,7 +165,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
ntracks = this->tochdr.ending_track
- this->tochdr.starting_track + 2;
this->tocent = (struct cd_toc_entry *)
- malloc(sizeof(*this->tocent) * ntracks);
+ xmalloc(sizeof(*this->tocent) * ntracks);
te.address_format = CD_LBA_FORMAT;
te.starting_track = 0;
@@ -929,6 +929,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
if (filename)
return NULL;
+
this->fd = open (CDROM, O_RDONLY);
@@ -954,16 +955,52 @@ static mrl_t **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->mrls[i-1]->mrl, "vcd://%d",i);
- this->mrls[i-1]->type = mrl_vcd;
+ char mrl[1024];
+
+ memset(&mrl, 0, strlen(mrl));
+ sprintf(mrl, "vcd://%d",i);
+
+ if((i-1) >= this->mrls_allocated_entries
+ || this->mrls_allocated_entries == 0) {
+ this->mrls[(i-1)] = (mrl_t *) xmalloc(sizeof(mrl_t));
+ }
+ else {
+ memset(this->mrls[(i-1)], 0, sizeof(mrl_t));
+ }
+
+ if(this->mrls[(i-1)]->mrl) {
+ this->mrls[(i-1)]->mrl = (char *)
+ realloc(this->mrls[(i-1)]->mrl, strlen(mrl) + 1);
+ }
+ else {
+ this->mrls[(i-1)]->mrl = (char *) xmalloc(strlen(mrl) + 1);
+ }
+
+ this->mrls[i-1]->origin = NULL;
+ sprintf(this->mrls[i-1]->mrl, "%s", mrl);
+ this->mrls[i-1]->link = NULL;
+ this->mrls[i-1]->type = (0 | mrl_vcd);
/* hack */
this->cur_track = i;
this->mrls[i-1]->size = vcd_plugin_get_length ((input_plugin_t *) this);
}
- this->mrls[*nEntries] = NULL;
+ /*
+ * Freeing exceeded mrls if exists.
+ */
+ if(*nEntries > this->mrls_allocated_entries)
+ this->mrls_allocated_entries = *nEntries;
+ else if(this->mrls_allocated_entries > *nEntries) {
+ while(this->mrls_allocated_entries > *nEntries) {
+ MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]);
+ free(this->mrls[this->mrls_allocated_entries--]);
+ }
+ }
+
+ this->mrls[*nEntries] = NULL;
+
return this->mrls;
}
@@ -1045,19 +1082,13 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
iface);
return NULL;
}
-
- this = (vcd_input_plugin_t *) calloc (1, sizeof (vcd_input_plugin_t));
+ this = (vcd_input_plugin_t *) xmalloc(sizeof(vcd_input_plugin_t));
for (i = 0; i < 100; i++) {
- this->filelist[i] = (char *) malloc (256);
- this->mrls[i] = (mrl_t *) malloc(sizeof(mrl_t));
- this->mrls[i]->mrl = (char *) malloc (256);
- this->mrls[i]->size = 0;
+ this->filelist[i] = (char *) xmalloc (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;
@@ -1078,6 +1109,10 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
+
+ this->mrls = (mrl_t **) xmalloc(sizeof(mrl_t));
+ this->mrls_allocated_entries = 0;
+
this->fd = -1;
this->mrl = NULL;
this->config = config;
diff --git a/src/libac3/Makefile.am b/src/libac3/Makefile.am
index 523e368aa..e783c3fb9 100644
--- a/src/libac3/Makefile.am
+++ b/src/libac3/Makefile.am
@@ -41,7 +41,7 @@ uninstall-includeHEADERS:
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am
index e2d591ac6..cf093d802 100644
--- a/src/libmpeg2/Makefile.am
+++ b/src/libmpeg2/Makefile.am
@@ -20,7 +20,7 @@ xineplug_decode_mpeg2_la_LDFLAGS = -avoid-version -module
noinst_HEADERS = vlc.h mpeg2.h mpeg2_internal.h
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/libmpg123/Makefile.am b/src/libmpg123/Makefile.am
index 04238af92..1d1aae7ba 100644
--- a/src/libmpg123/Makefile.am
+++ b/src/libmpg123/Makefile.am
@@ -37,7 +37,7 @@ uninstall-includeHEADERS:
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/libspudec/Makefile.am b/src/libspudec/Makefile.am
index 11d4cb535..578f038d4 100644
--- a/src/libspudec/Makefile.am
+++ b/src/libspudec/Makefile.am
@@ -35,7 +35,7 @@ uninstall-includeHEADERS:
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am
index dc70ec334..5012c03f4 100644
--- a/src/libw32dll/Makefile.am
+++ b/src/libw32dll/Makefile.am
@@ -24,10 +24,10 @@ xineplug_decode_w32dll_la_LIBADD = $(top_builddir)/src/libw32dll/wine/libwine.la
noinst_HEADERS = w32codec.h
debug:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) $@) \
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) $@) || exit;\
done;
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/libw32dll/wine/Makefile.am b/src/libw32dll/wine/Makefile.am
index f729a8187..a28aab089 100644
--- a/src/libw32dll/wine/Makefile.am
+++ b/src/libw32dll/wine/Makefile.am
@@ -34,7 +34,7 @@ stubs.lo: stubs.s
$(CC) -c $(top_srcdir)/src/libw32dll/wine/stubs.s -o stubs.lo
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
mostlyclean-generic:
-rm -f *~ \#* .*~ .\#*
diff --git a/src/libw32dll/wine/config.h b/src/libw32dll/wine/config.h
index f10850d9e..55a8c5ea6 100644
--- a/src/libw32dll/wine/config.h
+++ b/src/libw32dll/wine/config.h
@@ -3,7 +3,7 @@
* we need all these tests and checks in our
* configure.in
*/
-#if 1
+#if 0
#include "../../config.h"
#else
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index 743725355..18705e611 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -46,7 +46,7 @@ noinst_HEADERS = yuv2rgb.h video_out_syncfb.h alphablend.h
include_HEADERS = video_out_x11.h
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS) -DXINE_COMPILE"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) -DXINE_COMPILE"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
@@ -63,13 +63,12 @@ install-includeHEADERS: $(include_HEADERS)
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p; \
done
-
###
# Remove them
#
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
- list='$(include_HEADERS)'; for p in $$list; do \
+ @list='$(include_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(includedir)/xine/$$p; \
done
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 74c56fb13..3f8a30189 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -42,7 +42,7 @@ cpu_accel.lo: cpu_accel.c
debug:
- $(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index a7b1aa924..b63100e11 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.28 2001/07/04 17:10:24 uid32519 Exp $
+ * $Id: load_plugins.c,v 1.29 2001/07/10 21:07:56 f1rmb Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -217,7 +217,7 @@ static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) {
if(!this->num_input_plugins)
return NULL;
- plugin_ids = xmalloc (this->num_input_plugins * sizeof (char *));
+ plugin_ids = (char **) xmalloc (this->num_input_plugins * sizeof (char *));
for(i = 0; i < this->num_input_plugins; i++) {
@@ -402,7 +402,7 @@ char **xine_list_video_output_plugins (int visual_type) {
int i,j;
int plugin_prios[50];
- plugin_ids = xmalloc (50 * sizeof (char *));
+ plugin_ids = (char **) xmalloc (50 * sizeof (char *));
plugin_ids[0] = NULL;
dir = opendir (XINE_PLUGINDIR);
@@ -570,7 +570,7 @@ char **xine_list_audio_output_plugins(void) {
int num_plugins = 0;
DIR *dir;
- plugin_ids = xmalloc (50 * sizeof (char *));
+ plugin_ids = (char **) xmalloc (50 * sizeof (char *));
plugin_ids[0] = NULL;
dir = opendir (XINE_PLUGINDIR);