diff options
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/Makefile.am | 10 | ||||
-rw-r--r-- | src/input/input_cdda.c | 74 | ||||
-rw-r--r-- | src/input/input_dvb.c | 206 | ||||
-rw-r--r-- | src/input/input_dvd.c | 23 | ||||
-rw-r--r-- | src/input/input_file.c | 6 | ||||
-rw-r--r-- | src/input/input_http.c | 15 | ||||
-rw-r--r-- | src/input/input_mms.c | 14 | ||||
-rw-r--r-- | src/input/input_smb.c | 4 | ||||
-rw-r--r-- | src/input/libdvdnav/diff_against_cvs.patch | 33 | ||||
-rw-r--r-- | src/input/libdvdnav/ifo_types.h | 22 | ||||
-rw-r--r-- | src/input/libreal/real.c | 2 | ||||
-rw-r--r-- | src/input/vcd/xineplug_inp_vcd.c | 4 |
12 files changed, 197 insertions, 216 deletions
diff --git a/src/input/Makefile.am b/src/input/Makefile.am index a2a1ea3a4..ae38de187 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -115,8 +115,9 @@ xineplug_inp_pnm_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pnm_la_LDFLAGS = -avoid-version -module xineplug_inp_dvb_la_SOURCES = input_dvb.c net_buf_ctrl.c -xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -xineplug_inp_dvb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) +xineplug_inp_dvb_la_DEPS = $(XDG_BASEDIR_DEPS) +xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(XDG_BASEDIR_LIBS) +xineplug_inp_dvb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) $(XDG_BASEDIR_CFLAGS) xineplug_inp_dvb_la_LDFLAGS = -avoid-version -module xineplug_inp_rtsp_la_SOURCES = input_rtsp.c net_buf_ctrl.c @@ -125,8 +126,9 @@ xineplug_inp_rtsp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtsp_la_LDFLAGS = -avoid-version -module xineplug_inp_cdda_la_SOURCES = input_cdda.c media_helper.c sha1.c sha1.h base64.c base64.h -xineplug_inp_cdda_la_LIBADD = $(XINE_LIB) -xineplug_inp_cdda_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) +xineplug_inp_cdda_la_DEPS = $(XDG_BASEDIR_DEPS) +xineplug_inp_cdda_la_LIBADD = $(XINE_LIB) $(XDG_BASEDIR_LIBS) +xineplug_inp_cdda_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) $(XDG_BASEDIR_CFLAGS) xineplug_inp_cdda_la_LDFLAGS = -avoid-version -module xineplug_inp_v4l_la_SOURCES = input_v4l.c diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 7dd9ae21a..80f0bda39 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -41,6 +41,9 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#ifdef HAVE_ALLOCA_H +# include <alloca.h> +#endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> @@ -55,6 +58,8 @@ #include <netinet/in.h> #include <sys/socket.h> +#include <basedir.h> + #define LOG_MODULE "input_cdda" #define LOG_VERBOSE /* @@ -128,7 +133,6 @@ typedef struct { int enabled; char *server; int port; - char *cache_dir; char *cdiscid; char *disc_title; @@ -617,7 +621,10 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f #elif defined(__FreeBSD__) || defined(__NetBSD__) #include <sys/cdio.h> + +#ifdef HAVE_SYS_SCSIIO_H #include <sys/scsiio.h> +#endif static int read_cdrom_toc(int fd, cdrom_toc *toc) { @@ -1184,15 +1191,6 @@ static void port_changed_cb(void *data, xine_cfg_entry_t *cfg) { this->cddb.port = cfg->num_value; } } -static void cachedir_changed_cb(void *data, xine_cfg_entry_t *cfg) { - cdda_input_class_t *class = (cdda_input_class_t *) data; - - if(class->ip) { - cdda_input_plugin_t *this = class->ip; - - this->cddb.cache_dir = cfg->str_value; - } -} #ifdef CDROM_SELECT_SPEED static void speed_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; @@ -1334,18 +1332,6 @@ static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { } /* - * Where, by default, cddb cache files will be saved - */ -static char *_cdda_cddb_get_default_location(void) { - static char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; - - memset(&buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "%s/.xine/cddbcache", (xine_get_homedir())); - - return buf; -} - -/* * Read from socket, fill char *s, return size length. */ static int _cdda_cddb_socket_read(cdda_input_plugin_t *this, char *str, int size) { @@ -1444,15 +1430,18 @@ static int _cdda_cddb_handle_code(char *buf) { * Try to load cached cddb infos */ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { - char cdir[XINE_PATH_MAX + XINE_NAME_MAX + 1]; + char *cdir = NULL; DIR *dir; + const char *const xdg_cache_home = xdgCacheHome(this->stream->xine->basedir_handle); + if(this == NULL) return 0; - memset(&cdir, 0, sizeof(cdir)); - snprintf(cdir, sizeof(cdir), "%s", this->cddb.cache_dir); - + cdir = alloca(strlen(xdg_cache_home) + sizeof("/"PACKAGE"/cddb")); + strcpy(cdir, xdg_cache_home); + strcat(cdir, "/"PACKAGE"/cddb"); + if((dir = opendir(cdir)) != NULL) { struct dirent *pdir; @@ -1576,20 +1565,24 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { * Save cddb grabbed infos. */ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *filecontent) { - char cfile[XINE_PATH_MAX + XINE_NAME_MAX + 1]; FILE *fd; - + DIR *dir; + char *cfile; + + const char *const xdg_cache_home = xdgCacheHome(this->stream->xine->basedir_handle); + if((this == NULL) || (filecontent == NULL)) return; - memset(&cfile, 0, sizeof(cfile)); + /* the filename is always 8 characters */ + cfile = alloca(strlen(xdg_cache_home) + sizeof("/"PACKAGE"/cddb") + 9); + strcpy(cfile, xdg_cache_home); + strcat(cfile, "/"PACKAGE"/cddb"); - /* Ensure "~/.xine/cddbcache" exist */ - snprintf(cfile, sizeof(cfile), "%s", this->cddb.cache_dir); - + /* Ensure the cache directory exists */ _cdda_mkdir_recursive_safe(this->stream->xine, cfile); - snprintf(cfile, sizeof(cfile), "%s/%08lx", this->cddb.cache_dir, this->cddb.disc_id); + sprintf(cfile, "%s/%08lx", cfile, this->cddb.disc_id); if((fd = fopen(cfile, "w")) == NULL) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -2460,7 +2453,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { if(this->cddb.num_tracks) { int t; - this->cddb.track = (trackinfo_t *) xine_xmalloc(sizeof(trackinfo_t) * this->cddb.num_tracks); + this->cddb.track = (trackinfo_t *) xine_xcalloc(this->cddb.num_tracks, sizeof(trackinfo_t)); for(t = 0; t < this->cddb.num_tracks; t++) { int length = (toc->toc_entries[t].first_frame_minute * CD_SECONDS_PER_MINUTE + @@ -2686,10 +2679,6 @@ static input_plugin_t *cdda_class_get_instance (input_class_t *cls_gen, xine_str &port_entry)) port_changed_cb(class, &port_entry); - if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_cachedir", - &cachedir_entry)) - cachedir_changed_cb(class, &cachedir_entry); - class->cddb_error = cddb_error; return (input_plugin_t *)this; @@ -2712,7 +2701,6 @@ static void cdda_class_dispose (input_class_t *this_gen) { config->unregister_callback(config, "media.audio_cd.use_cddb"); config->unregister_callback(config, "media.audio_cd.cddb_server"); config->unregister_callback(config, "media.audio_cd.cddb_port"); - config->unregister_callback(config, "media.audio_cd.cddb_cachedir"); #ifdef CDROM_SELECT_SPEED config->unregister_callback(config, "media.audio_cd.drive_slowdown"); #endif @@ -2781,14 +2769,6 @@ static void *init_plugin (xine_t *xine, void *data) { "title and track information from."), XINE_CONFIG_SECURITY, port_changed_cb, (void *) this); - config->register_filename(config, "media.audio_cd.cddb_cachedir", - (_cdda_cddb_get_default_location()), XINE_CONFIG_STRING_IS_DIRECTORY_NAME, - _("CDDB cache directory"), _("The replies from the CDDB server will be " - "cached in this directory.\nThis setting is security critical, because files " - "with uncontrollable names will be created in this directory. Be sure to use " - "a dedicated directory not used for anything but CDDB caching."), XINE_CONFIG_SECURITY, - cachedir_changed_cb, (void *) this); - #ifdef CDROM_SELECT_SPEED config->register_num(config, "media.audio_cd.drive_slowdown", 4, _("slow down disc drive to this speed factor"), diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 10d6eca55..fd2c5f570 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -66,17 +66,22 @@ * OSD - this will allow for filtering/searching of epg data - useful for automatic recording :) */ -/* pthread.h must be included first so rest of the headers are imported - thread safely (on some systems). */ -#include <pthread.h> - #ifdef HAVE_CONFIG_H #include "config.h" #endif +/* pthread.h must be included first so rest of the headers are imported + thread safely (on some systems). + However, including it before config.h causes problems with asprintf not + being declared (glibc 2.3.6) +*/ +#include <pthread.h> + #include <assert.h> #include <stdio.h> #include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <string.h> @@ -95,6 +100,9 @@ #endif #include <ctype.h> +/* XDG */ +#include <basedir.h> + /* These will eventually be #include <linux/dvb/...> */ #include "dvb/dmx.h" #include "dvb/frontend.h" @@ -703,7 +711,7 @@ static int find_param(const Param *list, const char *name) return list->value;; } -static int extract_channel_from_string(channel_t * channel,char * str,fe_type_t fe_type) +static int extract_channel_from_string_internal(channel_t * channel,char * str,fe_type_t fe_type) { /* try to extract channel data from a string in the following format @@ -864,55 +872,69 @@ static int extract_channel_from_string(channel_t * channel,char * str,fe_type_t return 0; } -static channel_t *load_channels(dvb_input_plugin_t *this, int *num_ch, fe_type_t fe_type) { +static int extract_channel_from_string(channel_t *channel, char *str, fe_type_t fe_type) +{ + channel->name = NULL; + if (!extract_channel_from_string_internal(channel, str, fe_type)) + return 0; + free (channel->name); /* without this, we have a possible memleak */ + return -1; +} + +static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch, fe_type_t fe_type) { FILE *f; char str[BUFSIZE]; char filename[BUFSIZE]; - channel_t *channels; - int num_channels; + channel_t *channels = NULL; + int num_channels = 0; + int num_alloc = 0; int i; - xine_t *xine = this->class->xine; - - snprintf(filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); + struct stat st; - f = fopen(filename, "rb"); + snprintf(filename, BUFSIZE, "%s/"PACKAGE"/channels.conf", xdgConfigHome(xine->basedir_handle)); + + f = fopen(filename, "r"); if (!f) { - xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s'\n"), filename); - _x_message(this->stream, XINE_MSG_FILE_NOT_FOUND, filename, "Please run the dvbscan utility.", NULL); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s': %s\n"), filename, strerror (errno)); + if (!f && stream) + _x_message(stream, XINE_MSG_FILE_NOT_FOUND, filename, "Please run the dvbscan utility.", NULL); return NULL; } - - /* - * count and alloc channels - */ - num_channels = 0; - while ( fgets (str, BUFSIZE, f)) { - num_channels++; - } - fclose (f); - - if(num_channels > 0) - xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: expecting %d channels...\n", num_channels); - else { - xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: no channels found in the file: giving up.\n"); + if (fstat(fileno(f), &st) || !S_ISREG (st.st_mode)) { + xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: dvb channel file '%s' is not a plain file\n"), filename); + fclose(f); return NULL; } - channels = xine_xmalloc (sizeof (channel_t) * num_channels); - - _x_assert(channels != NULL); - /* * load channel list */ - f = fopen (filename, "rb"); - num_channels = 0; while ( fgets (str, BUFSIZE, f)) { - if (extract_channel_from_string(&(channels[num_channels]),str,fe_type) < 0) + channel_t channel = {0}; + + /* lose trailing spaces & control characters */ + i = strlen (str); + while (i && str[i - 1] <= ' ') + --i; + if (i == 0) + continue; + str[i] = 0; + + if (extract_channel_from_string(&channel,str,fe_type) < 0) continue; + if (num_channels >= num_alloc) { + channel_t *new_channels = xine_xmalloc((num_alloc += 32) * sizeof (channel_t)); + _x_assert(new_channels != NULL); + memcpy(new_channels, channels, num_channels * sizeof (channel_t)); + free(channels); + channels = new_channels; + } + + channels[num_channels] = channel; + /* Initially there's no EPG data in the EPG structs. */ channels[num_channels].epg_count = 0; for (i = 0; i < MAX_EPG_ENTRIES_PER_CHANNEL; ++i) @@ -922,6 +944,9 @@ static channel_t *load_channels(dvb_input_plugin_t *this, int *num_ch, fe_type_t } fclose(f); + /* free any trailing unused entries */ + channels = realloc (channels, num_channels * sizeof (channel_t)); + if(num_channels > 0) xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: found %d channels...\n", num_channels); else { @@ -934,6 +959,14 @@ static channel_t *load_channels(dvb_input_plugin_t *this, int *num_ch, fe_type_t return channels; } +static void free_channel_list (channel_t *channels, int num_channels) +{ + if (channels) + while (--num_channels >= 0) + free(channels[num_channels].name); + free(channels); +} + static int tuner_set_diseqc(tuner_t *this, channel_t *c) { struct dvb_diseqc_master_cmd cmd = @@ -2624,7 +2657,7 @@ static void dvb_plugin_dispose (input_plugin_t *this_gen) { } } if (this->channels) - free (this->channels); + free_channel_list (this->channels, this->num_channels); /* Make the EPG updater thread return. */ @@ -2719,7 +2752,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) * and assume that its format is valid for our tuner type */ - if (!(channels = load_channels(this, &num_channels, tuner->feinfo.type))) + if (!(channels = load_channels(this->class->xine, this->stream, &num_channels, tuner->feinfo.type))) { /* failed to load the channels */ tuner_dispose(tuner); @@ -3120,77 +3153,49 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, { dvb_input_class_t *class = (dvb_input_class_t *) this_gen; channel_t *channels=NULL; - FILE *f; - char *tmpbuffer=xine_xmalloc(BUFSIZE); - char *foobuffer=xine_xmalloc(BUFSIZE); - char *str=tmpbuffer; - int num_channels; - int nlines=0; - int default_channel; - xine_cfg_entry_t lastchannel_enable; + char foobuffer[BUFSIZE]; + int ch, apch, num_channels; + int default_channel = -1; + xine_cfg_entry_t lastchannel_enable = {0}; xine_cfg_entry_t lastchannel; - _x_assert(tmpbuffer != NULL); - _x_assert(foobuffer != NULL); - - snprintf(tmpbuffer, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); - num_channels = 0; - f=fopen (tmpbuffer,"rb"); - if(!f){ /* channels.conf not found in .xine */ - class->mrls[0]="Sorry, No channels.conf found"; - class->mrls[1]="Please run the dvbscan utility"; - class->mrls[2]="from the dvb drivers apps package"; - class->mrls[3]="and place the file in ~/.xine/"; + if (!(channels = load_channels(class->xine, NULL, &num_channels, 0))) { + static char *placefile = NULL; + /* channels.conf not found in .xine */ + class->mrls[0]="Sorry, no channels.conf found."; + class->mrls[1]="Please run the scan utility from the DVB"; + class->mrls[2]="drivers apps package and place the file in"; + if (!placefile) + asprintf (&placefile, "%s/"PACKAGE"/", xdgConfigHome(class->xine->basedir_handle)); + class->mrls[3]=placefile; *num_files=4; - free(tmpbuffer); - free(foobuffer); return class->mrls; - } else { - while (fgets(str, BUFSIZE, f)) - nlines++; } - fclose (f); - if (xine_config_lookup_entry(class->xine, "media.dvb.remember_channel", &lastchannel_enable)) - if (lastchannel_enable.num_value){ - num_channels++; - if (xine_config_lookup_entry(class->xine, "media.dvb.last_channel", &lastchannel)) - default_channel = lastchannel.num_value; - } - - if (nlines+lastchannel_enable.num_value >= MAX_AUTOCHANNELS) - nlines = MAX_AUTOCHANNELS-lastchannel_enable.num_value; - - snprintf(tmpbuffer, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); - - - f=fopen (tmpbuffer,"rb"); - channels=xine_xmalloc(sizeof(channel_t)*(nlines+lastchannel_enable.num_value)); - - _x_assert(channels != NULL); - - - while (fgets(str,BUFSIZE,f) && num_channels < nlines+lastchannel_enable.num_value) { - if (extract_channel_from_string (&(channels[num_channels]), str, 0) < 0) - continue; - - sprintf(foobuffer,"dvb://%s",channels[num_channels].name); - if(class->autoplaylist[num_channels]) - free(class->autoplaylist[num_channels]); - class->autoplaylist[num_channels]=xine_xmalloc(128); + if (xine_config_lookup_entry(class->xine, "media.dvb.remember_channel", &lastchannel_enable) + && lastchannel_enable.num_value + && xine_config_lookup_entry(class->xine, "media.dvb.last_channel", &lastchannel)) + { + default_channel = lastchannel.num_value - 1; + if (default_channel < 0 || default_channel >= num_channels) + default_channel = -1; + } - _x_assert(class->autoplaylist[num_channels] != NULL); - - class->autoplaylist[num_channels]=strdup(foobuffer); - num_channels++; - } + for (ch = 0, apch = !!lastchannel_enable.num_value; + ch < num_channels && ch < MAX_AUTOCHANNELS; + ++ch, ++apch) { + snprintf(foobuffer, BUFSIZE, "dvb://%s", channels[ch].name); + free(class->autoplaylist[apch]); + class->autoplaylist[apch] = strdup(foobuffer); + _x_assert(class->autoplaylist[apch] != NULL); + } if (lastchannel_enable.num_value){ - if (lastchannel.num_value > -1 && lastchannel.num_value < num_channels) + if (default_channel != -1) /* plugin has been used before - channel is valid */ - sprintf (foobuffer, "dvb://%s", channels[lastchannel.num_value].name); + sprintf (foobuffer, "dvb://%s", channels[default_channel].name); else /* set a reasonable default - the first channel */ sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0"); @@ -3198,13 +3203,10 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, class->autoplaylist[0]=strdup(foobuffer); } - free(tmpbuffer); - free(foobuffer); - free(channels); - fclose(f); + free_channel_list(channels, num_channels); - *num_files = num_channels; - class->numchannels=nlines; + *num_files = num_channels + lastchannel_enable.num_value; + class->numchannels = *num_files; return class->autoplaylist; } diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index de47de0d5..1a8861289 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -158,7 +158,7 @@ # define lseek64 lseek #endif -static const char *dvdnav_menu_table[] = { +static const char *const dvdnav_menu_table[] = { NULL, NULL, "Title", @@ -1629,7 +1629,7 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st this->mem_stack = 0; this->mem_stack_max = 1024; - this->mem = xine_xmalloc(sizeof(unsigned char *) * this->mem_stack_max); + this->mem = xine_xcalloc(this->mem_stack_max, sizeof(unsigned char *)); if (!this->mem) { free(this); return NULL; @@ -1791,8 +1791,7 @@ static void *init_class (xine_t *xine, void *data) { { /* we have found libdvdcss, enable the specific config options */ char *raw_device; - static const char *decrypt_modes[] = { "key", "disc", "title", NULL }; - char *css_cache_default, *css_cache; + static const char *const decrypt_modes[] = { "key", "disc", "title", NULL }; int mode; raw_device = config->register_filename(config, "media.dvd.raw_device", @@ -1817,22 +1816,6 @@ static void *init_class (xine_t *xine, void *data) { "playing scrambled DVDs."), 20, NULL, NULL); xine_setenv("DVDCSS_METHOD", decrypt_modes[mode], 0); - css_cache_default = (char *)malloc(strlen(xine_get_homedir()) + 10); - sprintf(css_cache_default, "%s/.dvdcss/", xine_get_homedir()); - css_cache = config->register_filename(config, "media.dvd.css_cache_path", css_cache_default, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, - _("path to the title key cache"), - _("Since cracking the copy protection of scrambled DVDs can " - "be quite time consuming, libdvdcss will cache the cracked " - "keys in this directory.\nThis setting is security critical, " - "because files with uncontrollable names will be created in " - "this directory. Be sure to use a dedicated directory not " - "used for anything but DVD key caching."), - XINE_CONFIG_SECURITY, NULL, NULL); - if (strlen(css_cache) > 0) - xine_setenv("DVDCSS_CACHE", css_cache, 0); - free(css_cache_default); - - if(xine->verbosity > XINE_VERBOSITY_NONE) xine_setenv("DVDCSS_VERBOSE", "2", 0); else diff --git a/src/input/input_file.c b/src/input/input_file.c index fd2b0e733..0ec25e1f8 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -723,9 +723,9 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, return NULL; } - dir_files = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t) * MAXFILES); - hide_files = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t) * MAXFILES); - norm_files = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t) * MAXFILES); + dir_files = (xine_mrl_t *) xine_xcalloc(MAXFILES, sizeof(xine_mrl_t)); + hide_files = (xine_mrl_t *) xine_xcalloc(MAXFILES, sizeof(xine_mrl_t)); + norm_files = (xine_mrl_t *) xine_xcalloc(MAXFILES, sizeof(xine_mrl_t)); while((pdirent = readdir(pdir)) != NULL) { diff --git a/src/input/input_http.c b/src/input/input_http.c index 3adbc836b..6b7ae9158 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -181,7 +181,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { /* \177\0\0\1 is the *octal* representation of 127.0.0.1 */ if ( info->h_addrtype == AF_INET && !memcmp(info->h_addr_list[0], "\177\0\0\1", 4) ) { lprintf("host '%s' is localhost\n", host); - return 1; + return 0; } /* TODO: IPv6 check */ } @@ -200,13 +200,13 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { /* special-case domain beginning with '=' -> is a host name */ if (domain[0] == '=' && strcmp(target, domain + 1) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } noprox_len = strlen(domain); /* special-case host==domain, avoiding dot checks */ if (host_len == noprox_len && strcmp(target, domain) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } /* check for host in domain, and require that (if matched) the domain * name is preceded by a dot, either in the host or domain strings, @@ -216,7 +216,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { && (domain[0] == '.' || target[host_len - noprox_len - 1] == '.') && strcmp(target + host_len - noprox_len, domain) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } lprintf("host '%s' isn't in no-proxy domain '%s'\n", target, domain); } @@ -225,7 +225,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { } free(no_proxy); - return 0; + return 1; } static int http_plugin_basicauth (const char *user, const char *password, char* dest, int len) { @@ -663,9 +663,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) { _x_message(this->stream, XINE_MSG_GENERAL_WARNING, "malformed url", NULL); return 0; } - if (use_proxy && _x_use_proxy(this_class, this->host)) { - use_proxy = 0; - } + use_proxy = use_proxy && _x_use_proxy(this_class, this->host); + if (this->port == 0) this->port = DEFAULT_HTTP_PORT; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 05c0b168b..739d81a59 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -59,15 +59,15 @@ static const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, 115200,262200,393216,524300,1544000,10485800}; -static const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char *const mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; /* connection methods */ -static const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; +static const char *const mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; typedef struct { input_plugin_t input_plugin; diff --git a/src/input/input_smb.c b/src/input/input_smb.c index 1b1f15565..4cacebf89 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -258,8 +258,8 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, } if ((dir = smbc_opendir(current_path_smb)) >= 0){ - xine_mrl_t *dir_files = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t) * MAXFILES); - xine_mrl_t *norm_files = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t) * MAXFILES); + xine_mrl_t *dir_files = (xine_mrl_t *) xine_xcalloc(MAXFILES, sizeof(xine_mrl_t)); + xine_mrl_t *norm_files = (xine_mrl_t *) xine_xcalloc(MAXFILES, sizeof(xine_mrl_t)); int num_dir_files=0; int num_norm_files=0; while ((pdirent = smbc_readdir(dir)) != NULL){ diff --git a/src/input/libdvdnav/diff_against_cvs.patch b/src/input/libdvdnav/diff_against_cvs.patch index 202474fef..b9b1dbe8b 100644 --- a/src/input/libdvdnav/diff_against_cvs.patch +++ b/src/input/libdvdnav/diff_against_cvs.patch @@ -432,3 +432,36 @@ diff -u -p -u -r1.19 searching.c if(this->position_current.still != 0) { printerr("Cannot seek in a still frame."); +--- src/input/libdvdnav/ifo_types.h Tue Apr 10 13:13:59 2007 +0200 ++++ src/input/libdvdnav/ifo_types.h Tue Apr 10 13:38:19 2007 +0200 +@@ -23,2 +25,2 @@ + #include <inttypes.h> + #include "dvd_reader.h" + ++#include "config.h" ++ +- +-#undef ATTRIBUTE_PACKED +-#undef PRAGMA_PACK_BEGIN +-#undef PRAGMA_PACK_END +- +-#if defined(__GNUC__) +-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +-#define ATTRIBUTE_PACKED __attribute__ ((packed)) +-#define PRAGMA_PACK 0 +-#endif +-#endif +- +-#if !defined(ATTRIBUTE_PACKED) +-#define ATTRIBUTE_PACKED +-#define PRAGMA_PACK 1 +-#endif +- +-#if PRAGMA_PACK +-#pragma pack(1) +-#endif +- ++#define ATTRIBUTE_PACKED XINE_PACKED + + /** + * Common diff --git a/src/input/libdvdnav/ifo_types.h b/src/input/libdvdnav/ifo_types.h index 17be98f83..e9332ecec 100644 --- a/src/input/libdvdnav/ifo_types.h +++ b/src/input/libdvdnav/ifo_types.h @@ -23,27 +23,9 @@ #include <inttypes.h> #include "dvd_reader.h" +#include "config.h" -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -#if PRAGMA_PACK -#pragma pack(1) -#endif - +#define ATTRIBUTE_PACKED XINE_PACKED /** * Common diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index dc0c001bd..da7c0c443 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -461,7 +461,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt desc->copyright, desc->abstract); header->data=rmff_new_dataheader(0,0); - header->streams = xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); + header->streams = xine_xcalloc((desc->stream_count+1), sizeof(rmff_mdpr_t*)); lprintf("number of streams: %u\n", desc->stream_count); for (i=0; i<desc->stream_count; i++) { diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index a15899f2d..b234be6d1 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1807,13 +1807,13 @@ vcd_init (xine_t *xine, void *data) /*Note: these labels have to be listed in the same order as the enumeration vcdplayer_autoplay_t in vcdplayer.h. */ - static const char *autoplay_modes[] = + static const char *const autoplay_modes[] = { "MPEG track", "entry", "segment", "playback-control item", NULL }; /*Note: these labels have to be listed in the same order as the enumeration vcdplayer_slider_length_t in vcdplayer.h. */ - static const char *length_reporting_modes[] = + static const char *const length_reporting_modes[] = { "auto", "track", "entry", NULL }; my_vcd.player.default_autoplay = |