summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--po/it.po6
-rw-r--r--src/demuxers/demux_ts.c41
-rw-r--r--src/input/input_file.c9
4 files changed, 45 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a1395109..685d79a1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,9 @@ xine-lib (1.1.7) (unreleased)
also avoids an improper saturation.
* Prioritize the musepack demuxer over mpgaudio, as sometimes the latter can
misfire and report a good file as unplayable.
+ * Fix an mmap problem with huge files on 32-bit systems.
+ * Improved MPEG PES stream handling: specifically, misdetection of data
+ streams as PES streams.
xine-lib (1.1.6)
* Split the DirectFB plugin into X11 and non-X versions.
diff --git a/po/it.po b/po/it.po
index 09ab92649..c2fdfd57a 100644
--- a/po/it.po
+++ b/po/it.po
@@ -5139,10 +5139,10 @@ msgstr ""
msgid "load_plugins: plugin %s found\n"
msgstr "load_plugins: trovato plugin %s\n"
-#: src/xine-engine/load_plugins.c:502
-#, fuzzy, c-format
+#: src/xine-engine/load_plugins.c:499
+#, c-format
msgid "load_plugins: static plugin found\n"
-msgstr "load_plugins: trovato plugin statico %s\n"
+msgstr "load_plugins: trovato plugin statico\n"
#: src/xine-engine/load_plugins.c:509
#, c-format
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index b40c7d49f..0c8b4e974 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -180,6 +180,8 @@
#define MAX_PES_BUF_SIZE 2048
+#define CORRUPT_PES_THRESHOLD 10
+
#define NULL_PID 0x1fff
#define INVALID_PID ((unsigned int)(-1))
#define INVALID_PROGRAM ((unsigned int)(-1))
@@ -913,12 +915,17 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) {
- m->corrupted_pes = 1;
m->buf->free_buffer(m->buf);
m->buf = NULL;
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+
+ if (m->corrupted_pes > CORRUPT_PES_THRESHOLD) {
+ if (this->videoPid == m->pid)
+ this->videoPid = INVALID_PID;
+ } else {
+ m->corrupted_pes++;
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid);
-
+ }
} else {
m->corrupted_pes = 0;
@@ -1784,13 +1791,27 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) {
if ( this->videoPid == INVALID_PID) {
-
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_ts: auto-detected video pid 0x%.4x\n", pid);
-
- this->videoPid = pid;
- this->videoMedia = this->media_num;
- demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id);
+ int i, found = 0;
+ for(i = 0; i < this->media_num; i++) {
+ if (this->media[i].pid == pid) {
+ found = 1;
+ break;
+ }
+ }
+
+ if (found && (this->media[i].corrupted_pes == 0)) {
+ this->videoPid = pid;
+ this->videoMedia = i;
+ } else if (!found) {
+ this->videoPid = pid;
+ this->videoMedia = this->media_num;
+ demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id);
+ }
+
+ if (this->videoPid != INVALID_PID) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: auto-detected video pid 0x%.4x\n", pid);
+ }
}
} else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) {
if (this->audio_tracks_count < MAX_AUDIO_TRACKS) {
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 0ec25e1f8..1dce8baad 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -359,6 +359,9 @@ static int file_plugin_open (input_plugin_t *this_gen ) {
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
char *filename;
struct stat sbuf;
+#ifdef HAVE_MMAP
+ size_t tmp_size;
+#endif
lprintf("file_plugin_open\n");
@@ -423,10 +426,14 @@ static int file_plugin_open (input_plugin_t *this_gen ) {
}
#ifdef HAVE_MMAP
- if ( (this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 ) {
+ tmp_size = sbuf.st_size; /* may cause truncation - if it does, DON'T mmap! */
+ if ((tmp_size == sbuf.st_size) &&
+ ( (this->mmap_base = mmap(NULL, tmp_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 )) {
this->mmap_on = 1;
this->mmap_curr = this->mmap_base;
this->mmap_len = sbuf.st_size;
+ } else {
+ this->mmap_base = NULL;
}
#endif