summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/Makefile.am4
-rw-r--r--src/input/http_helper.c18
-rw-r--r--src/input/http_helper.h13
-rw-r--r--src/input/input_cdda.c283
-rw-r--r--src/input/input_dvb.c12
-rw-r--r--src/input/input_dvd.c8
-rw-r--r--src/input/input_file.c10
-rw-r--r--src/input/input_gnome_vfs.c7
-rw-r--r--src/input/input_http.c29
-rw-r--r--src/input/input_mms.c7
-rw-r--r--src/input/input_net.c14
-rw-r--r--src/input/input_pnm.c20
-rw-r--r--src/input/input_pvr.c12
-rw-r--r--src/input/input_rtp.c14
-rw-r--r--src/input/input_rtsp.c20
-rw-r--r--src/input/input_smb.c9
-rw-r--r--src/input/input_stdin_fifo.c15
-rw-r--r--src/input/input_vcd.c18
-rw-r--r--src/input/libdvdnav/bswap.h2
-rw-r--r--src/input/libdvdnav/diff_against_cvs.patch2
-rw-r--r--src/input/libdvdnav/dvd_reader.c2
-rw-r--r--src/input/libdvdnav/dvd_reader.h2
-rw-r--r--src/input/libdvdnav/md5.c2
-rw-r--r--src/input/libdvdnav/remap.c1
-rw-r--r--src/input/libreal/asmrp.c4
-rw-r--r--src/input/libreal/real.c4
-rw-r--r--src/input/libreal/rmff.c38
-rw-r--r--src/input/libreal/sdpplin.c4
-rw-r--r--src/input/librtsp/rtsp.c4
-rw-r--r--src/input/librtsp/rtsp_session.c4
-rw-r--r--src/input/mms.c16
-rw-r--r--src/input/mmsh.c2
-rw-r--r--src/input/pnm.c2
-rw-r--r--src/input/vcd/Makefile.am1
-rw-r--r--src/input/vcd/libcdio/MSWindows/aspi32.c4
-rw-r--r--src/input/vcd/xineplug_inp_vcd.c2
36 files changed, 388 insertions, 221 deletions
diff --git a/src/input/Makefile.am b/src/input/Makefile.am
index 81dd62eca..998fc6c81 100644
--- a/src/input/Makefile.am
+++ b/src/input/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_builddir)/misc/Makefile.plugins
include $(top_srcdir)/misc/Makefile.common
EXTRA_DIST = input_dvd.c input_vcd.c input_gnome_vfs.c input_rtp.c
@@ -45,6 +46,9 @@ endif
if WIN32
else
in_rtp = xineplug_inp_rtp.la
+endif
+
+if DVB
in_dvb = xineplug_inp_dvb.la
endif
diff --git a/src/input/http_helper.c b/src/input/http_helper.c
index 279d3ff05..db93b9b45 100644
--- a/src/input/http_helper.c
+++ b/src/input/http_helper.c
@@ -29,8 +29,18 @@
#include "xine_internal.h"
#include "http_helper.h"
+
+const char *_x_url_user_agent (const char *url)
+{
+ if (!strncasecmp (url, "qthttp://", 9))
+ return "QuickTime"; /* needed for Apple trailers */
+ return NULL;
+}
+
int _x_parse_url (char *url, char **proto, char** host, int *port,
- char **user, char **password, char **uri) {
+ char **user, char **password, char **uri,
+ const char **user_agent)
+{
char *start = NULL;
char *authcolon = NULL;
char *at = NULL;
@@ -63,6 +73,9 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
end = start + strlen(start) - 1;
*proto = strndup(url, start - url);
+ if (user_agent)
+ *user_agent = _x_url_user_agent (url);
+
/* user:password */
start += 3;
at = strchr(start, '@');
@@ -185,6 +198,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
} else
*it = start[i];
}
+ *it = '\0';
}
}
} else {
@@ -257,7 +271,7 @@ static int check_url(char *url, int ok) {
printf("--------------------------------\n");
printf("url=%s\n", url);
res = _x_parse_url (url,
- &proto, &host, &port, &user, &password, &uri);
+ &proto, &host, &port, &user, &password, &uri, NULL);
if (res) {
printf("proto=%s, host=%s, port=%d, user=%s, password=%s, uri=%s\n",
proto, host, port, user, password, uri);
diff --git a/src/input/http_helper.h b/src/input/http_helper.h
index 3ce3f2b7c..68299a2ea 100644
--- a/src/input/http_helper.h
+++ b/src/input/http_helper.h
@@ -24,6 +24,16 @@
#define HTTP_HELPER_H
/*
+ * user agent finder, using modified protcol names
+ * {proto}://...
+ * e.g. "qthttp://example.com/foo.mov" → "QuickTime"
+ *
+ * return:
+ * NULL or user agent prefix
+ */
+const char *_x_url_user_agent (const char *url);
+
+/*
* url parser
* {proto}://{user}:{password}@{host}:{port}{uri}
* {proto}://{user}:{password}@{[host]}:{port}{uri}
@@ -33,7 +43,8 @@
* 1 valid url
*/
int _x_parse_url (char *url, char **proto, char** host, int *port,
- char **user, char **password, char **uri);
+ char **user, char **password, char **uri,
+ const char **user_agent);
/*
* canonicalise url, given base
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 996460832..70bd34f35 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -71,6 +71,8 @@
#define DEFAULT_CDDA_DEVICE "/vol/dev/aliases/cdrom0"
#elif defined(WIN32)
#define DEFAULT_CDDA_DEVICE "d:\\"
+#elif defined(__OpenBSD__)
+#define DEFAULT_CDDA_DEVICE "/dev/rcd0c"
#else
#define DEFAULT_CDDA_DEVICE "/dev/cdrom"
#endif
@@ -111,7 +113,7 @@ typedef struct _cdrom_toc {
*************************************************************************/
#define MAX_TRACKS 99
-#define CACHED_FRAMES 500
+#define CACHED_FRAMES 100
typedef struct {
int start;
@@ -611,7 +613,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
return 0;
}
-#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__)
+#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/cdio.h>
@@ -624,7 +626,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
struct ioc_toc_header tochdr;
#if defined(__FreeBSD_kernel__)
struct ioc_read_toc_single_entry tocentry;
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
struct ioc_read_toc_entry tocentry;
struct cd_toc_entry data;
#endif
@@ -659,7 +661,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
perror("CDIOREADTOCENTRY");
return -1;
}
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
memset(&data, 0, sizeof(data));
tocentry.data_len = sizeof(data);
tocentry.data = &data;
@@ -680,7 +682,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
(tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) +
(tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) +
tocentry.entry.addr.msf.frame;
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
toc->toc_entries[i-1].track_mode = (tocentry.data->control & 0x04) ? 1 : 0;
toc->toc_entries[i-1].first_frame_minute = tocentry.data->addr.msf.minute;
toc->toc_entries[i-1].first_frame_second = tocentry.data->addr.msf.second;
@@ -702,7 +704,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
perror("CDIOREADTOCENTRY");
return -1;
}
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
memset(&data, 0, sizeof(data));
tocentry.data_len = sizeof(data);
tocentry.data = &data;
@@ -723,7 +725,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
(tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) +
(tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) +
tocentry.entry.addr.msf.frame;
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
toc->leadout_track.track_mode = (tocentry.data->control & 0x04) ? 1 : 0;
toc->leadout_track.first_frame_minute = tocentry.data->addr.msf.minute;
toc->leadout_track.first_frame_second = tocentry.data->addr.msf.second;
@@ -761,7 +763,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
perror("CDIOCREADAUDIO");
return -1;
}
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
scsireq_t req;
int nblocks = 1;
@@ -1431,6 +1433,73 @@ static int _cdda_cddb_handle_code(char *buf) {
return err;
}
+static inline char *_cdda_append (/*const*/ char *first, const char *second)
+{
+ if (!first)
+ return strdup (second);
+
+ char *result = (char *) realloc (first, strlen (first) + strlen (second) + 1);
+ strcat (result, second);
+ return result;
+}
+
+static void _cdda_parse_cddb_info (cdda_input_plugin_t *this, char *buffer, char **dtitle)
+{
+ /* buffer should be no more than 2048 bytes... */
+ char buf[2048];
+ int track_no;
+
+ if (sscanf (buffer, "DTITLE=%s", &buf[0]) == 1) {
+ char *pt = strchr (buffer, '=');
+ if (pt) {
+ ++pt;
+
+ *dtitle = _cdda_append (*dtitle, pt);
+ pt = strdup (*dtitle);
+
+ char *title = strstr (pt, " / ");
+ if (title)
+ {
+ *title = 0;
+ title += 3;
+ free (this->cddb.disc_artist);
+ this->cddb.disc_artist = strdup (pt);
+ }
+ else
+ title = pt;
+
+ free (this->cddb.disc_title);
+ this->cddb.disc_title = strdup (title);
+
+ free (pt);
+ }
+ }
+ else if (sscanf (buffer, "DYEAR=%s", &buf[0]) == 1) {
+ char *pt = strchr (buffer, '=');
+ if (pt && strlen (pt) == 5)
+ this->cddb.disc_year = strdup (pt + 1);
+ }
+ else if(sscanf(buffer, "DGENRE=%s", &buf[0]) == 1) {
+ char *pt = strchr(buffer, '=');
+ if (pt)
+ this->cddb.disc_category = strdup (pt + 1);
+ }
+ else if (sscanf (buffer, "TTITLE%d=%s", &track_no, &buf[0]) == 2) {
+ char *pt = strchr(buffer, '=');
+ this->cddb.track[track_no].title = _cdda_append (this->cddb.track[track_no].title, pt + 1);
+ }
+ else if (!strncmp (buffer, "EXTD=", 5))
+ {
+ if (!this->cddb.disc_year)
+ {
+ int nyear;
+ char *y = strstr (buffer, "YEAR:");
+ if (y && sscanf (y + 5, "%4d", &nyear) == 1)
+ asprintf (&this->cddb.disc_year, "%d", nyear);
+ }
+ }
+}
+
/*
* Try to load cached cddb infos
*/
@@ -1463,82 +1532,16 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
return 0;
}
else {
- char buffer[256], *ln;
- char buf[256];
- int tnum;
+ char buffer[2048], *ln;
char *dtitle = NULL;
- while ((ln = fgets(buffer, 255, fd)) != NULL) {
-
- buffer[strlen(buffer) - 1] = '\0';
-
- if (sscanf(buffer, "DTITLE=%s", &buf[0]) == 1) {
- char *pt, *artist, *title;
-
- pt = strchr(buffer, '=');
- if (pt) {
- pt++;
-
- if (dtitle != NULL)
- {
- dtitle = (char *) realloc(dtitle, strlen(dtitle) + strlen(pt) + 1);
- strcat(dtitle, pt);
- pt = dtitle;
- }
- dtitle = strdup(pt);
-
- artist = pt;
- title = strstr(pt, " / ");
- if (title) {
- *title++ = '\0';
- title += 2;
- }
- else {
- title = artist;
- artist = NULL;
- }
-
- if (artist)
- this->cddb.disc_artist = strdup(artist);
-
- this->cddb.disc_title = strdup(title);
- }
- }
- else if (sscanf(buffer, "DYEAR=%s", &buf[0]) == 1) {
- char *pt;
+ while ((ln = fgets(buffer, sizeof (buffer) - 1, fd)) != NULL) {
- pt = strrchr(buffer, '=');
- pt++;
- if (pt != NULL && strlen(pt) == 4)
- this->cddb.disc_year = strdup(pt);
- }
- else if (sscanf(buffer, "TTITLE%d=%s", &tnum, &buf[0]) == 2) {
- char *pt;
-
- pt = strchr(buffer, '=');
- if (pt)
- pt++;
- if (this->cddb.track[tnum].title == NULL)
- this->cddb.track[tnum].title = strdup(pt);
- else
- {
- this->cddb.track[tnum].title
- = (char *) realloc(this->cddb.track[tnum].title, strlen(this->cddb.track[tnum].title) + strlen(pt) + 1);
- strcat(this->cddb.track[tnum].title, pt);
- }
- }
- else {
- if (!strncmp(buffer, "EXTD=", 5)) {
- char *y;
- int nyear;
-
- y = strstr(buffer, "YEAR:");
- if (y && this->cddb.disc_year == NULL) {
- if (sscanf(y+5, "%4d", &nyear) == 1)
- asprintf(&this->cddb.disc_year, "%d", nyear);
- }
- }
- }
+ int length = strlen (buffer);
+ if (length && buffer[length - 1] == '\n')
+ buffer[length - 1] = '\0';
+
+ _cdda_parse_cddb_info (this, buffer, &dtitle);
}
fclose(fd);
free(dtitle);
@@ -1726,7 +1729,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) {
memset(&buffer, 0, sizeof(buffer));
err = _cdda_cddb_socket_read(this, buffer, sizeof(buffer) - 1);
- if (err < 0 || (((err = _cdda_cddb_handle_code(buffer)) != 200) && (err != 210))) {
+ if (err < 0 || (((err = _cdda_cddb_handle_code(buffer)) != 200) && (err != 210) && (err != 211))) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"input_cdda: cddb query command returned error code '%03d'.\n", err);
_cdda_cddb_socket_close(this);
@@ -1747,7 +1750,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) {
}
}
- if (err == 210) {
+ if ((err == 210) || (err == 211)) {
memset(&buffer, 0, sizeof(buffer));
err = _cdda_cddb_socket_read(this, buffer, sizeof(buffer) - 1);
if (err < 0) {
@@ -1801,82 +1804,13 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) {
memset(&buffercache, 0, sizeof(buffercache));
while (strcmp(buffer, ".")) {
- char buf[2048];
- int tnum;
size_t bufsize = strlen(buffercache);
memset(&buffer, 0, sizeof(buffer));
_cdda_cddb_socket_read(this, buffer, sizeof(buffer) - 1);
snprintf(buffercache + bufsize, sizeof(buffercache) - bufsize, "%s\n", buffer);
- if (sscanf(buffer, "DTITLE=%s", &buf[0]) == 1) {
- char *pt, *artist, *title;
-
- pt = strrchr(buffer, '=');
- if (pt) {
- pt++;
-
- if (dtitle != NULL)
- {
- dtitle = (char *) realloc(dtitle, strlen(dtitle) + strlen(pt) + 1);
- strcat(dtitle, pt);
- pt = dtitle;
- }
- dtitle = strdup(pt);
-
- artist = pt;
- title = strstr(pt, " / ");
- if (title) {
- *title++ = '\0';
- title += 2;
- }
- else {
- title = artist;
- artist = NULL;
- }
-
- if (artist) {
- this->cddb.disc_artist = strdup(artist);
- }
- this->cddb.disc_title = strdup(title);
- }
- }
- else if(sscanf(buffer, "DYEAR=%s", &buf[0]) == 1) {
- char *pt;
-
- pt = strrchr(buffer, '=');
- pt++;
- if (pt != NULL && strlen(pt) == 4)
- this->cddb.disc_year = strdup(pt);
- }
- else if (sscanf(buffer, "TTITLE%d=%s", &tnum, &buf[0]) == 2) {
- char *pt;
-
- pt = strrchr(buffer, '=');
- if (pt) {
- pt++;
- if (this->cddb.track[tnum].title == NULL)
- this->cddb.track[tnum].title = strdup(pt);
- else
- {
- this->cddb.track[tnum].title
- = (char *) realloc(this->cddb.track[tnum].title, strlen(this->cddb.track[tnum].title) + strlen(pt) + 1);
- strcat(this->cddb.track[tnum].title, pt);
- }
- }
- }
- else {
- if (!strncmp(buffer, "EXTD=", 5)) {
- char *y;
- int nyear;
-
- y = strstr(buffer, "YEAR:");
- if (y && this->cddb.disc_year == NULL) {
- if (sscanf(y+5, "%4d", &nyear) == 1)
- asprintf(&this->cddb.disc_year, "%d", nyear);
- }
- }
- }
+ _cdda_parse_cddb_info (this, buffer, &dtitle);
}
free(dtitle);
@@ -2084,9 +2018,9 @@ static int cdda_open(cdda_input_plugin_t *this_gen,
hASPI = LoadLibrary( "wnaspi32.dll" );
if( hASPI != NULL )
{
- (FARPROC) lpGetSupport = GetProcAddress( hASPI,
+ lpGetSupport = GetProcAddress( hASPI,
"GetASPI32SupportInfo" );
- (FARPROC) lpSendCommand = GetProcAddress( hASPI,
+ lpSendCommand = GetProcAddress( hASPI,
"SendASPI32Command" );
}
@@ -2224,26 +2158,18 @@ static int cdda_close(cdda_input_plugin_t *this_gen) {
static uint32_t cdda_plugin_get_capabilities (input_plugin_t *this_gen) {
- return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK;
+ return INPUT_CAP_SEEKABLE;
}
static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) {
- /* only allow reading in block-sized chunks */
-
- return 0;
-}
-
-static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
- off_t nlen) {
-
cdda_input_plugin_t *this = (cdda_input_plugin_t *) this_gen;
- buf_element_t *buf;
- unsigned char frame_data[CD_RAW_FRAME_SIZE];
int err = 0;
- if (nlen != CD_RAW_FRAME_SIZE)
+ /* only allow reading in block-sized chunks */
+
+ if (len != CD_RAW_FRAME_SIZE)
return 0;
if (this->current_frame > this->last_frame)
@@ -2277,14 +2203,26 @@ static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buf
if( err < 0 )
return 0;
- memcpy(frame_data, this->cache[this->current_frame-this->cache_first], CD_RAW_FRAME_SIZE);
+ memcpy(buf, this->cache[this->current_frame-this->cache_first], CD_RAW_FRAME_SIZE);
this->current_frame++;
+ return CD_RAW_FRAME_SIZE;
+}
+
+static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
+ off_t nlen) {
+
+ buf_element_t *buf;
+
buf = fifo->buffer_pool_alloc(fifo);
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
- buf->size = CD_RAW_FRAME_SIZE;
- memcpy(buf->mem, frame_data, CD_RAW_FRAME_SIZE);
+
+ buf->size = cdda_plugin_read(this_gen, buf->content, nlen);
+ if (buf->size == 0) {
+ buf->free_buffer(buf);
+ buf = NULL;
+ }
return buf;
}
@@ -2322,7 +2260,7 @@ static off_t cdda_plugin_get_length (input_plugin_t *this_gen) {
static uint32_t cdda_plugin_get_blocksize (input_plugin_t *this_gen) {
- return CD_RAW_FRAME_SIZE;
+ return 0;
}
static const char* cdda_plugin_get_mrl (input_plugin_t *this_gen) {
@@ -2489,6 +2427,9 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) {
}
lprintf("Track %d Title: %s\n", this->track+1, pt);
+ char tracknum[4];
+ snprintf(tracknum, 4, "%d", this->track+1);
+ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_TRACK_NUMBER, tracknum);
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_TITLE, pt);
}
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 0fa5ba971..54c40087e 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -67,7 +67,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
/* pthread.h must be included first so rest of the headers are imported
@@ -286,7 +286,7 @@ typedef struct {
xine_t *xine;
- char *mrls[5];
+ char *mrls[6];
int numchannels;
@@ -2602,6 +2602,12 @@ static buf_element_t *dvb_plugin_read_block (input_plugin_t *this_gen,
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
int total_bytes;
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -2869,6 +2875,8 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
if (lastchannel.num_value) {
if (xine_config_lookup_entry(this->class->xine, "media.dvb.last_channel", &lastchannel)){
this->channel = lastchannel.num_value -1;
+ if (this->channel < 0 || this->channel >= num_channels)
+ this->channel = 0; /* out of range? default */
}else{
xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: invalid channel specification, defaulting to channel 0\n"));
this->channel = 0;
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index a845d7628..4f8827dbd 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -53,7 +53,9 @@
#include <dlfcn.h>
#ifndef WIN32
+#if ! defined(__GNU__)
#include <sys/mount.h>
+#endif
#include <sys/wait.h>
#include <sys/poll.h>
@@ -115,6 +117,9 @@
/* There really isn't a default on Windows! */
#define DVD_PATH "d:\\"
#define RDVD_PATH "d:\\"
+#elif defined(__OpenBSD__)
+#define DVD_PATH "/dev/rcd0c"
+#define RDVD_PATH "/dev/rcd0c"
#else
#define DVD_PATH "/dev/dvd"
#define RDVD_PATH "/dev/rdvd"
@@ -850,6 +855,9 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
static off_t dvd_plugin_read (input_plugin_t *this_gen, char *ch_buf, off_t len) {
/* dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; */
+ if (len < 4)
+ return -1;
+
/* FIXME: Tricking the demux_mpeg_block plugin */
ch_buf[0] = 0;
ch_buf[1] = 0;
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 774f6b081..2187f0007 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -145,6 +145,9 @@ static int check_mmap_file(file_input_plugin_t *this) {
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;
+ if (len < 0)
+ return -1;
+
#ifdef HAVE_MMAP
if ( check_mmap_file(this) ) {
off_t l = len;
@@ -166,6 +169,13 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->type = BUF_DEMUX_BLOCK;
#ifdef HAVE_MMAP
diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c
index 0848b9206..a3dfafdd5 100644
--- a/src/input/input_gnome_vfs.c
+++ b/src/input/input_gnome_vfs.c
@@ -121,6 +121,13 @@ gnomevfs_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 169a0d384..4eece116f 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -91,6 +91,8 @@ typedef struct {
char *host;
int port;
char *uri;
+
+ const char *user_agent;
char preview[MAX_PREVIEW_SIZE];
off_t preview_size;
@@ -421,6 +423,9 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
num_bytes = 0;
+ if (nlen < 0)
+ return -1;
+
if (this->curpos < this->preview_size) {
if (nlen > (this->preview_size - this->curpos))
@@ -437,7 +442,7 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
n = nlen - num_bytes;
- if (n) {
+ if (n > 0) {
int read_bytes;
read_bytes = http_plugin_read_int (this, &buf[num_bytes], n);
@@ -503,6 +508,13 @@ static buf_element_t *http_plugin_read_block (input_plugin_t *this_gen, fifo_buf
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -554,7 +566,7 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
@@ -576,7 +588,7 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin
offset -= this->curpos;
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
@@ -679,7 +691,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
if (!_x_parse_url(this->mrl, &this->proto, &this->host, &this->port,
- &this->user, &this->password, &this->uri)) {
+ &this->user, &this->password, &this->uri,
+ &this->user_agent)) {
_x_message(this->stream, XINE_MSG_GENERAL_WARNING, "malformed url", NULL);
return 0;
}
@@ -778,10 +791,12 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
}
buflen += snprintf(this->buf + buflen, BUFSIZE - buflen,
- "User-Agent: xine/%s\015\012"
+ "User-Agent: %s%sxine/%s\015\012"
"Accept: */*\015\012"
"Icy-MetaData: 1\015\012"
"\015\012",
+ this->user_agent ? this->user_agent : "",
+ this->user_agent ? " " : "",
VERSION);
if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) {
_x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send request", NULL);
@@ -996,6 +1011,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
this->preview_size = http_plugin_read_int (this, this->preview, MAX_PREVIEW_SIZE);
}
if (this->preview_size < 0) {
+ this->preview_size = 0;
xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error %d\n"), errno);
return -12;
}
@@ -1018,7 +1034,8 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str
if (strncasecmp (mrl, "http://", 7) &&
strncasecmp (mrl, "unsv://", 7) &&
- strncasecmp (mrl, "peercast://pls/", 15)) {
+ strncasecmp (mrl, "peercast://pls/", 15) &&
+ !_x_url_user_agent (mrl) /* user agent hacks */) {
return NULL;
}
this = calloc(1, sizeof(http_input_plugin_t));
diff --git a/src/input/input_mms.c b/src/input/input_mms.c
index 158b40448..cd88a0609 100644
--- a/src/input/input_mms.c
+++ b/src/input/input_mms.c
@@ -122,6 +122,13 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen,
lprintf ("mms_plugin_read_block: %"PRId64" bytes...\n", todo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 391f33a60..d9da27b54 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -253,6 +253,9 @@ static off_t net_plugin_read (input_plugin_t *this_gen,
lprintf("reading %" PRIdMAX " bytes...\n", (intmax_t)len);
+ if (len < 0)
+ return -1;
+
total=0;
if (this->curpos < this->preview_size) {
n = this->preview_size - this->curpos;
@@ -288,6 +291,13 @@ static buf_element_t *net_plugin_read_block (input_plugin_t *this_gen,
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
off_t total_bytes;
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -331,7 +341,7 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
@@ -353,7 +363,7 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
offset -= this->curpos;
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c
index 669d24d28..f609695d5 100644
--- a/src/input/input_pnm.c
+++ b/src/input/input_pnm.c
@@ -83,7 +83,8 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen,
lprintf ("pnm_plugin_read: %"PRId64" bytes ...\n", len);
n = pnm_read (this->pnm, buf, len);
- this->curpos += n;
+ if (n >= 0)
+ this->curpos += n;
return n;
}
@@ -96,6 +97,13 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen,
lprintf ("pnm_plugin_read_block: %"PRId64" bytes...\n", todo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -123,10 +131,16 @@ static off_t pnm_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- this->curpos += pnm_plugin_read (this_gen, this->scratch, BUFSIZE);
+ off_t n = pnm_plugin_read (this_gen, this->scratch, BUFSIZE);
+ if (n <= 0)
+ return this->curpos;
+ this->curpos += n;
}
- this->curpos += pnm_plugin_read (this_gen, this->scratch, offset);
+ off_t n = pnm_plugin_read (this_gen, this->scratch, offset);
+ if (n <= 0)
+ return this->curpos;
+ this->curpos += n;
}
return this->curpos;
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 009c76939..a9c92e42e 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -424,6 +424,9 @@ static uint32_t pvr_plugin_get_capabilities (input_plugin_t *this_gen) {
static off_t pvr_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) {
/*pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen;*/
+ if (len < 4)
+ return -1;
+
/* FIXME: Tricking the demux_mpeg_block plugin */
buf[0] = 0;
buf[1] = 0;
@@ -1204,6 +1207,14 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff
return NULL;
}
+ buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer(buf);
+ return NULL;
+ }
+
if( this->scr_tunning == -2 )
speed = this->speed_before_pause;
@@ -1227,7 +1238,6 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff
pvr_event_handler(this);
- buf = fifo->buffer_pool_alloc (fifo);
buf->content = buf->mem;
pthread_mutex_lock(&this->lock);
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index 66fcba87e..90bae6670 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -453,6 +453,9 @@ static off_t rtp_plugin_read (input_plugin_t *this_gen,
struct timespec timeout;
off_t copied = 0;
+ if (length < 0)
+ return -1;
+
while(length > 0) {
off_t n;
@@ -524,6 +527,12 @@ static buf_element_t *rtp_plugin_read_block (input_plugin_t *this_gen,
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
int total_bytes;
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -609,11 +618,14 @@ static int rtp_plugin_get_optional_data (input_plugin_t *this_gen,
if (data_type == INPUT_OPTIONAL_DATA_PREVIEW) {
if (!this->preview_read_done) {
this->preview_size = rtp_plugin_read(this_gen, this->preview, MAX_PREVIEW_SIZE);
+ if (this->preview_size < 0)
+ this->preview_size = 0;
lprintf("Preview data length = %d\n", this->preview_size);
this->preview_read_done = 1;
}
- memcpy(data, this->preview, this->preview_size);
+ if (this->preview_size)
+ memcpy(data, this->preview, this->preview_size);
return this->preview_size;
}
else {
diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c
index 110c4d4b6..fad395e0b 100644
--- a/src/input/input_rtsp.c
+++ b/src/input/input_rtsp.c
@@ -84,7 +84,8 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen,
lprintf ("rtsp_plugin_read: %"PRId64" bytes ...\n", len);
n = rtsp_session_read (this->rtsp, buf, len);
- this->curpos += n;
+ if (n > 0)
+ this->curpos += n;
return n;
}
@@ -97,6 +98,13 @@ static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen,
lprintf ("rtsp_plugin_read_block: %"PRId64" bytes...\n", todo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -123,10 +131,16 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- this->curpos += rtsp_plugin_read (this_gen, this->scratch, BUFSIZE);
+ off_t n = rtsp_plugin_read (this_gen, this->scratch, BUFSIZE);
+ if (n <= 0)
+ return this->curpos;
+ this->curpos += n;
}
- this->curpos += rtsp_plugin_read (this_gen, this->scratch, offset);
+ off_t n = rtsp_plugin_read (this_gen, this->scratch, offset);
+ if (n <= 0)
+ return this->curpos;
+ this->curpos += n;
}
return this->curpos;
diff --git a/src/input/input_smb.c b/src/input/input_smb.c
index 3d495f04e..e49eaa889 100644
--- a/src/input/input_smb.c
+++ b/src/input/input_smb.c
@@ -69,6 +69,8 @@ smb_plugin_read (input_plugin_t *this_gen, char *buf, off_t len)
smb_input_t *this = (smb_input_t *) this_gen;
off_t n, num_bytes;
+ if (len < 0)
+ return -1;
num_bytes = 0;
while (num_bytes < len)
@@ -89,6 +91,13 @@ smb_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index 0ae841b4b..64b8d748c 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.c
@@ -85,6 +85,8 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen,
off_t n, total;
lprintf ("reading %"PRId64" bytes...\n", len);
+ if (len < 0)
+ return -1;
total=0;
if (this->curpos < this->preview_size) {
@@ -121,6 +123,13 @@ static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_bu
/* stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; */
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ if (todo > buf->max_size)
+ todo = buf->max_size;
+ if (todo < 0) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
+
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -146,7 +155,7 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
@@ -168,7 +177,7 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig
offset -= this->curpos;
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
- if( !this_gen->read (this_gen, this->seek_buf, BUFSIZE) )
+ if( this_gen->read (this_gen, this->seek_buf, BUFSIZE) <= 0 )
return this->curpos;
}
@@ -270,6 +279,8 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) {
this->preview_size = stdin_plugin_read (&this->input_plugin, this->preview,
MAX_PREVIEW_SIZE);
+ if (this->preview_size < 0)
+ this->preview_size = 0;
this->curpos = 0;
return 1;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 760910a01..c99f57f09 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -92,7 +92,7 @@ typedef struct {
#if defined (__linux__) || defined(__sun)
struct cdrom_tochdr tochdr;
struct cdrom_tocentry tocent[100];
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
struct ioc_toc_header tochdr;
struct cd_toc_entry *tocent;
off_t cur_sec;
@@ -117,7 +117,7 @@ typedef struct {
int cur_track;
-#if defined (__linux__) || defined(__sun) || defined (__FreeBSD_kernel__)
+#if defined (__linux__) || defined(__sun) || defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
uint8_t cur_min, cur_sec, cur_frame;
#endif
@@ -177,7 +177,7 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) {
return 0;
}
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
static int input_vcd_read_toc (vcd_input_class_t *this, int fd) {
struct ioc_read_toc_entry te;
@@ -393,7 +393,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */
return VCDSECTORSIZE;
}
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
static off_t vcd_plugin_read (input_plugin_t *this_gen,
char *buf, off_t nlen) {
vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
@@ -531,7 +531,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
memcpy (buf->mem, data.data, VCDSECTORSIZE); /* FIXME */
return buf;
}
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
fifo_buffer_t *fifo, off_t nlen) {
@@ -690,7 +690,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
return offset ; /* FIXME */
}
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
static off_t vcd_plugin_seek (input_plugin_t *this_gen,
off_t offset, int origin) {
@@ -764,7 +764,7 @@ static off_t vcd_plugin_get_length (input_plugin_t *this_gen) {
return (off_t) 0;
}
-#elif defined (__FreeBSD_kernel__)
+#elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__)
static off_t vcd_plugin_get_length (input_plugin_t *this_gen) {
vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
off_t len ;
@@ -859,6 +859,10 @@ static int vcd_plugin_open (input_plugin_t *this_gen) {
this->cur_min = this->cls->tocent[this->cur_track].cdte_addr.msf.minute;
this->cur_sec = this->cls->tocent[this->cur_track].cdte_addr.msf.second;
this->cur_frame = this->cls->tocent[this->cur_track].cdte_addr.msf.frame;
+#elif defined (__OpenBSD__)
+ this->cur_min = this->cls->tocent[this->cur_track + 1 - this->cls->tochdr.starting_track].addr.msf.minute;
+ this->cur_sec = this->cls->tocent[this->cur_track + 1 - this->cls->tochdr.starting_track].addr.msf.second;
+ this->cur_frame = this->cls->tocent[this->cur_track + 1 - this->cls->tochdr.starting_track].addr.msf.frame;
#elif defined (__FreeBSD_kernel__)
{
int bsize = 2352;
diff --git a/src/input/libdvdnav/bswap.h b/src/input/libdvdnav/bswap.h
index 2a2d222fe..23f0251d6 100644
--- a/src/input/libdvdnav/bswap.h
+++ b/src/input/libdvdnav/bswap.h
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <config.h>
+#include "config.h"
#if defined(WORDS_BIGENDIAN)
/* All bigendian systems are fine, just ignore the swaps. */
diff --git a/src/input/libdvdnav/diff_against_cvs.patch b/src/input/libdvdnav/diff_against_cvs.patch
index 202474fef..6df704e2a 100644
--- a/src/input/libdvdnav/diff_against_cvs.patch
+++ b/src/input/libdvdnav/diff_against_cvs.patch
@@ -323,7 +323,7 @@ diff -u -p -u -r1.5 dvd_reader.h
-#ifdef _MSC_VER
+#ifdef HAVE_CONFIG_H
- #include <config.h>
+ #include "config.h"
+#endif
+#ifdef _MSC_VER
diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c
index eff1977fc..1e0d3016b 100644
--- a/src/input/libdvdnav/dvd_reader.c
+++ b/src/input/libdvdnav/dvd_reader.c
@@ -30,7 +30,9 @@
#include <string.h>
#include <unistd.h>
#include <limits.h>
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
+#endif
#ifndef HAVE_GETTIMEOFDAY
# ifdef WIN32
diff --git a/src/input/libdvdnav/dvd_reader.h b/src/input/libdvdnav/dvd_reader.h
index e1b051c00..c7b3f9df8 100644
--- a/src/input/libdvdnav/dvd_reader.h
+++ b/src/input/libdvdnav/dvd_reader.h
@@ -22,7 +22,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#ifdef _MSC_VER
diff --git a/src/input/libdvdnav/md5.c b/src/input/libdvdnav/md5.c
index 2bfdddee4..16b7b0690 100644
--- a/src/input/libdvdnav/md5.c
+++ b/src/input/libdvdnav/md5.c
@@ -21,7 +21,7 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include <sys/types.h>
diff --git a/src/input/libdvdnav/remap.c b/src/input/libdvdnav/remap.c
index 43c81c66f..df0be29ce 100644
--- a/src/input/libdvdnav/remap.c
+++ b/src/input/libdvdnav/remap.c
@@ -216,6 +216,7 @@ remap_t* remap_loadmap( char *title) {
remap_add_node( map, tmp);
}
}
+ close (fp); /* ignoring errors... */
if (map->nblocks == 0 && map->debug == 0) return NULL;
return map;
diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c
index 970fcb0f7..902c59d42 100644
--- a/src/input/libreal/asmrp.c
+++ b/src/input/libreal/asmrp.c
@@ -32,6 +32,10 @@
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c
index c0e11fa00..dcb90bcd0 100644
--- a/src/input/libreal/real.c
+++ b/src/input/libreal/real.c
@@ -21,6 +21,10 @@
* adopted from joschkas real tools.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <string.h>
diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c
index 41f85d3ae..2d3fcc613 100644
--- a/src/input/libreal/rmff.c
+++ b/src/input/libreal/rmff.c
@@ -21,6 +21,10 @@
* adopted from joschkas real tools
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#define LOG_MODULE "rmff"
#define LOG_VERBOSE
/*
@@ -330,12 +334,14 @@ static rmff_prop_t *rmff_scan_prop(const char *data) {
return prop;
}
-static rmff_mdpr_t *rmff_scan_mdpr(const char *data) {
-
- rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t));
+static rmff_mdpr_t *rmff_scan_mdpr(const char *data)
+{
+ rmff_mdpr_t *mdpr = calloc(sizeof(rmff_mdpr_t), 1);
mdpr->object_id=_X_BE_32(data);
mdpr->size=_X_BE_32(&data[4]);
+ if (mdpr->size < 46)
+ goto fail;
mdpr->object_version=_X_BE_16(&data[8]);
if (mdpr->object_version != 0)
{
@@ -351,21 +357,40 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) {
mdpr->duration=_X_BE_32(&data[36]);
mdpr->stream_name_size=data[40];
+ if (mdpr->size < 46 + mdpr->stream_name_size)
+ goto fail;
mdpr->stream_name = malloc(mdpr->stream_name_size+1);
+ if (!mdpr->stream_name)
+ goto fail;
memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size);
mdpr->stream_name[mdpr->stream_name_size]=0;
mdpr->mime_type_size=data[41+mdpr->stream_name_size];
+ if (mdpr->size < 46 + mdpr->stream_name_size + mdpr->mime_type_size)
+ goto fail;
mdpr->mime_type = malloc(mdpr->mime_type_size+1);
+ if (!mdpr->mime_type)
+ goto fail;
memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size);
mdpr->mime_type[mdpr->mime_type_size]=0;
mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]);
+ if (mdpr->size < 46 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_data)
+ goto fail;
mdpr->type_specific_data = malloc(mdpr->type_specific_len);
+ if (!mdpr->type_specific_data)
+ goto fail;
memcpy(mdpr->type_specific_data,
&data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
return mdpr;
+
+fail:
+ free (mdpr->stream_name);
+ free (mdpr->mime_type);
+ free (mdpr->type_specific_data);
+ free (mdpr);
+ return NULL;
}
static rmff_cont_t *rmff_scan_cont(const char *data) {
@@ -463,8 +488,11 @@ rmff_header_t *rmff_scan_header(const char *data) {
break;
case MDPR_TAG:
mdpr=rmff_scan_mdpr(ptr);
- chunk_size=mdpr->size;
- header->streams[mdpr->stream_number]=mdpr;
+ if (mdpr) /* FIXME: what to do if NULL? */
+ {
+ chunk_size=mdpr->size;
+ header->streams[mdpr->stream_number]=mdpr;
+ }
break;
case CONT_TAG:
header->cont=rmff_scan_cont(ptr);
diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c
index c1fab49c1..a07cb3360 100644
--- a/src/input/libreal/sdpplin.c
+++ b/src/input/libreal/sdpplin.c
@@ -19,6 +19,10 @@
*
* sdp/sdpplin parser.
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#define LOG_MODULE "sdpplin"
#define LOG_VERBOSE
diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c
index 07769064a..8d0d45ec5 100644
--- a/src/input/librtsp/rtsp.c
+++ b/src/input/librtsp/rtsp.c
@@ -22,7 +22,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#include <unistd.h>
@@ -255,7 +255,7 @@ static int rtsp_get_answers(rtsp_t *s) {
}
} else
{
- lprintf("setting session id to: %s\n", buf);
+ lprintf("setting session id to: %s\n", tmp);
s->session=strdup(tmp);
}
diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c
index 4e636410d..88103aa7d 100644
--- a/src/input/librtsp/rtsp_session.c
+++ b/src/input/librtsp/rtsp_session.c
@@ -20,6 +20,10 @@
* high level interface to rtsp servers.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/src/input/mms.c b/src/input/mms.c
index ab1983955..8ba33e704 100644
--- a/src/input/mms.c
+++ b/src/input/mms.c
@@ -290,7 +290,7 @@ static int send_command (mms_t *this, int command,
#ifdef USE_ICONV
static iconv_t string_utf16_open() {
- return iconv_open("UTF-16LE", nl_langinfo(CODESET));
+ return iconv_open("UTF-16LE", "UTF-8");
}
static void string_utf16_close(iconv_t url_conv) {
@@ -698,7 +698,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) {
report_progress (stream, 0);
if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port,
- &this->user, &this->password, &this->uri)) {
+ &this->user, &this->password, &this->uri, NULL)) {
lprintf ("invalid url\n");
goto fail;
}
@@ -771,10 +771,17 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) {
/* command 0x5 */
{
mms_buffer_t command_buffer;
- char *path = this->uri;
- size_t pathlen = strlen(path);
+ char *path, *unescaped;
+ size_t pathlen;
+
+ unescaped = strdup (this->uri);
+ if (!unescaped)
+ goto fail;
+ _x_mrl_unescape (unescaped);
/* remove the first '/' */
+ path = unescaped;
+ pathlen = strlen (path);
if (pathlen > 1) {
path++;
pathlen--;
@@ -785,6 +792,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) {
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
string_utf16 (url_conv, this->scmd_body + command_buffer.pos, path, pathlen);
+ free (unescaped);
if (!send_command (this, 5, 1, 0xffffffff, pathlen * 2 + 12))
goto fail;
}
diff --git a/src/input/mmsh.c b/src/input/mmsh.c
index 4ee7ed07d..2cc27c3b1 100644
--- a/src/input/mmsh.c
+++ b/src/input/mmsh.c
@@ -649,7 +649,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) {
report_progress (stream, 0);
if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port,
- &this->user, &this->password, &this->uri)) {
+ &this->user, &this->password, &this->uri, NULL)) {
xine_log (this->stream->xine, XINE_LOG_MSG, _("invalid url\n"));
goto fail;
}
diff --git a/src/input/pnm.c b/src/input/pnm.c
index cbd245e7b..aabdbde96 100644
--- a/src/input/pnm.c
+++ b/src/input/pnm.c
@@ -22,7 +22,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include <unistd.h>
diff --git a/src/input/vcd/Makefile.am b/src/input/vcd/Makefile.am
index 31ec6a44c..61eac753b 100644
--- a/src/input/vcd/Makefile.am
+++ b/src/input/vcd/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_builddir)/misc/Makefile.plugins
include $(top_srcdir)/misc/Makefile.common
SUBDIRS = libcdio libvcd
diff --git a/src/input/vcd/libcdio/MSWindows/aspi32.c b/src/input/vcd/libcdio/MSWindows/aspi32.c
index 238a4b4e9..e62f8a089 100644
--- a/src/input/vcd/libcdio/MSWindows/aspi32.c
+++ b/src/input/vcd/libcdio/MSWindows/aspi32.c
@@ -162,9 +162,9 @@ have_aspi( HMODULE *hASPI,
return false;
}
- (FARPROC) *lpGetSupport = GetProcAddress( *hASPI,
+ *lpGetSupport = (FARPROC)GetProcAddress( *hASPI,
"GetASPI32SupportInfo" );
- (FARPROC) *lpSendCommand = GetProcAddress( *hASPI,
+ *lpSendCommand = (FARPROC)GetProcAddress( *hASPI,
"SendASPI32Command" );
/* make sure that we've got both function addresses */
diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c
index 55b7f9b84..50382ee7e 100644
--- a/src/input/vcd/xineplug_inp_vcd.c
+++ b/src/input/vcd/xineplug_inp_vcd.c
@@ -20,7 +20,7 @@
/*
These are plugin routines called by the xine engine. See
Chapter 4. Extending xine's input
- http://xinehq.de/index.php/hackersguide/index.php?resource=5.3&action=default#INPUT
+ http://www.xine-project.org/hackersguide#INPUT
and the comments in input_plugin.h
This is what is referred to below a "the xine plugin spec"