diff options
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/Makefile.am | 10 | ||||
-rw-r--r-- | src/input/input_cdda.c | 71 | ||||
-rw-r--r-- | src/input/input_dvb.c | 29 | ||||
-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 | 20 | ||||
-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, 116 insertions, 122 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 0b1f046e8..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; @@ -1187,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; @@ -1337,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) { @@ -1447,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; @@ -1579,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, @@ -2463,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 + @@ -2689,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; @@ -2715,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 @@ -2784,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 736b4c6d7..efc3a88d8 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -66,14 +66,17 @@ * 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> @@ -97,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" @@ -887,8 +893,8 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch int num_alloc = 0; int i; struct stat st; - - snprintf(filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); + + snprintf(filename, BUFSIZE, "%s/"PACKAGE"/channels.conf", xdgConfigHome(xine->basedir_handle)); f = fopen(filename, "r"); if (!f) { @@ -3162,11 +3168,14 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, num_channels = 0; 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 dvbscan utility"; - class->mrls[2]="from the dvb drivers apps package"; - class->mrls[3]="and place the file 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; return class->mrls; } 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 6e8932700..12b7f3f35 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -93,16 +93,18 @@ typedef struct { char preview[MAX_PREVIEW_SIZE]; off_t preview_size; - + + /* 2 spare bytes here */ + + /* NSV */ + unsigned char is_nsv; /* bool */ + /* ShoutCast */ - int shoutcast_mode; + unsigned char shoutcast_mode; /* bool */ int shoutcast_metaint; off_t shoutcast_pos; char *shoutcast_songtitle; - /* NSV */ - int is_nsv; - /* scratch buffer for forward seeking */ char seek_buf[BUFSIZE]; @@ -829,7 +831,13 @@ static int http_plugin_open (input_plugin_t *this_gen ) { _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); return -7; - } else if (httpcode == 403 || httpcode == 401) { + } else if (httpcode == 401) { + _x_message(this->stream, XINE_MSG_AUTHENTICATION_NEEDED, this->mrl, NULL); + xine_log (this->stream->xine, XINE_LOG_MSG, + _("input_http: http status not 2xx: >%d %s<\n"), + httpcode, httpstatus); + return -8; + } else if (httpcode == 403) { _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), 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 5d5124579..0935f75d0 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 9eb9ac996..0f1c9225e 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1813,13 +1813,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 = |