summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/xine-engine/video_out.c1
-rw-r--r--src/xine-utils/xmllexer.c62
3 files changed, 65 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 418bcb0b8..03c72c969 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -67,6 +67,7 @@ xine-lib (1.1.9) (unreleased)
* Build fix for when using Linux 2.6.23 headers. [Bug 1820958]
* Implemented decoding of XML character entities with codes >= 256.
This requires conversion to UTF-8 of entities with codes >= 128.
+ * Handle initial Unicde BOMs in XML; convert other UTF encodings to UTF-8.
* Fixed ATSC support. [Bug 1749508]
* Fixed a possible DVB plugin crash when switching channels.
* Fixed a crash closing the frontend. [Bug FS#3]
@@ -80,6 +81,7 @@ xine-lib (1.1.9) (unreleased)
* DXR3 encoding with external ffmpeg should be fixed now.
(This was broken by ffmpeg revision 9283).
* Enabled the WMV VC1 (ffmpeg) codec.
+ * Fixed a crash that happened when a video output was closed
xine-lib (1.1.8)
* Send a channel-changed event to the frontend when receiving the SYNC
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 575017301..8c9810da1 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -979,6 +979,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts,
if (!img->stream ||
_x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) ||
+ !img->stream->video_fifo ||
img->stream->video_fifo->size(img->stream->video_fifo) < 10) {
lprintf ("possible still frame\n");
diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c
index 39632938f..3f0383c48 100644
--- a/src/xine-utils/xmllexer.c
+++ b/src/xine-utils/xmllexer.c
@@ -40,6 +40,8 @@
#include <iconv.h>
#endif
+#include "bswap.h"
+
/* private constants*/
/* private global variables */
@@ -47,6 +49,45 @@ static const char * lexbuf;
static int lexbuf_size = 0;
static int lexbuf_pos = 0;
static int in_comment = 0;
+static char *lex_malloc = NULL;
+
+enum utf { UTF32BE, UTF32LE, UTF16BE, UTF16LE };
+
+static void lex_convert (const char * buf, int size, enum utf utf)
+{
+ char *utf8 = malloc (size * (utf >= UTF16BE ? 3 : 6) + 1);
+ char *bp = utf8;
+ while (size > 0)
+ {
+ uint32_t c = 0;
+ switch (utf)
+ {
+ case UTF32BE: c = _X_BE_32 (buf); buf += 4; break;
+ case UTF32LE: c = _X_LE_32 (buf); buf += 4; break;
+ case UTF16BE: c = _X_BE_16 (buf); buf += 2; break;
+ case UTF16LE: c = _X_LE_16 (buf); buf += 2; break;
+ }
+ if (!c)
+ break; /* embed a NUL, get a truncated string */
+ if (c < 128)
+ *bp++ = c;
+ else
+ {
+ int count = (c >= 0x04000000) ? 5 :
+ (c >= 0x00200000) ? 4 :
+ (c >= 0x00010000) ? 3 :
+ (c >= 0x00000800) ? 2 : 1;
+ *bp = (char)(0x1F80 >> count);
+ count *= 6;
+ *bp++ |= c >> count;
+ while ((count -= 6) >= 0)
+ *bp++ = 128 | ((c >> count) & 0x3F);
+ }
+ }
+ *bp = 0;
+ lexbuf_size = bp - utf8;
+ lexbuf = lex_malloc = realloc (utf8, lexbuf_size + 1);
+}
static enum {
NORMAL,
@@ -55,8 +96,29 @@ static enum {
} lex_mode = NORMAL;
void lexer_init(const char * buf, int size) {
+ static const char boms[] = { 0xFF, 0xFE, 0, 0, 0xFE, 0xFF },
+ bom_utf8[] = { 0xEF, 0xBB, 0xBF };
+
+ free (lex_malloc);
+ lex_malloc = NULL;
+
lexbuf = buf;
lexbuf_size = size;
+
+ if (size >= 4 && !memcmp (buf, boms + 2, 4))
+ lex_convert (buf + 4, size - 4, UTF32BE);
+ else if (size >= 4 && !memcmp (buf, boms, 4))
+ lex_convert (buf + 4, size - 4, UTF32LE);
+ else if (size >= 3 && !memcmp (buf, bom_utf8, 4))
+ {
+ lexbuf += 3;
+ lexbuf_size -= 3;
+ }
+ else if (size >= 2 && !memcmp (buf, boms + 4, 2))
+ lex_convert (buf + 2, size - 2, UTF16BE);
+ else if (size >= 2 && !memcmp (buf, boms, 2))
+ lex_convert (buf + 2, size - 2, UTF16LE);
+
lexbuf_pos = 0;
lex_mode = NORMAL;
in_comment = 0;