From 8b477584846b8086cb0423c91796830398099754 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 5 Jun 2008 00:10:44 +0100 Subject: demux_ts: don't OR in buffer types. --- src/demuxers/demux_ts.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 37b0603fa..80ad0acb1 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -756,7 +756,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; - m->type |= BUF_AUDIO_A52; + m->type = BUF_AUDIO_A52; return 1; } else if (m->descriptor_tag == ISO_13818_PES_PRIVATE @@ -766,7 +766,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p; m->size = packet_len; - m->type |= BUF_SPU_DVB; + m->type = BUF_SPU_DVB; m->buf->decoder_info[2] = payload_len; return 1; } else if ((p[0] & 0xE0) == 0x20) { @@ -780,7 +780,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+4; m->size = packet_len - 4; - m->type |= BUF_AUDIO_A52; + m->type = BUF_AUDIO_A52; return 1; } else if ((p[0]&0xf0) == 0xa0) { @@ -796,7 +796,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+pcm_offset; m->size = packet_len-pcm_offset; - m->type |= BUF_AUDIO_LPCM_BE; + m->type = BUF_AUDIO_LPCM_BE; return 1; } @@ -834,16 +834,16 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, case ISO_11172_AUDIO: case ISO_13818_AUDIO: lprintf ("demux_ts: found MPEG audio track.\n"); - m->type |= BUF_AUDIO_MPEG; + m->type = BUF_AUDIO_MPEG; break; case ISO_13818_PART7_AUDIO: case ISO_14496_PART3_AUDIO: lprintf ("demux_ts: found AAC audio track.\n"); - m->type |= BUF_AUDIO_AAC; + m->type = BUF_AUDIO_AAC; break; default: lprintf ("demux_ts: unknown audio type: %d, defaulting to MPEG.\n", m->descriptor_tag); - m->type |= BUF_AUDIO_MPEG; + m->type = BUF_AUDIO_MPEG; break; } return 1; -- cgit v1.2.3 From 089d7ce7450a4af86f2b6426b475a2da1d451a7d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 9 Jun 2008 21:13:43 +0100 Subject: Avoid false positives when looking up demuxer by MIME type. These occur where the MIME type used as the key is a substring of a type in some plugin's MIME type list but is not an exact match. --- src/xine-engine/load_plugins.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 107e7d792..031c94984 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2519,47 +2519,38 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { plugin_catalog_t *catalog = self->plugin_catalog; plugin_node_t *node; char *id = NULL; - char *mime_arg, *mime_demux; - char *s; - const char *mt; int list_id, list_size; + const size_t mime_type_len = strlen (mime_type); - /* create a copy and convert to lower case */ - mime_arg = strdup(mime_type); - for(s=mime_arg; *s; s++) - *s = tolower(*s); - pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); for (list_id = 0; (list_id < list_size) && !id; list_id++) { - demux_class_t *cls; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { - cls = (demux_class_t *)node->plugin_class; - - mt = cls->get_mimetypes (cls); - if (mt) { - mime_demux = strdup(mt); - - for(s=mime_demux; *s; s++) - *s = tolower(*s); - - if( strstr(mime_demux, mime_arg) ) - id = strdup(node->info->id); - - free(mime_demux); + demux_class_t *cls = (demux_class_t *)node->plugin_class; + const char *mime = cls->get_mimetypes (cls); + while (mime) + { + while (*mime == ';' || isspace (*mime)) + ++mime; + if (!strncmp (mime, mime_type, mime_type_len) && + (!mime[mime_type_len] || mime[mime_type_len] == ':' || mime[mime_type_len] == ';')) + { + free (id); + id = strdup(node->info->id); + break; + } + mime = strchr (mime, ';'); } } } pthread_mutex_unlock (&catalog->lock); - free(mime_arg); - return id; } -- cgit v1.2.3 From 224cd3a6d96fd943d3375e0385841972e29e95d0 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 9 Jun 2008 21:18:54 +0100 Subject: Fix Shoutcast NSV detection. Leading whitespace could prevent this from working. --- src/input/input_http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/input_http.c b/src/input/input_http.c index dab7310c3..cbc2e8140 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -919,7 +919,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) { /* content type */ if (!strncasecmp(this->buf, TAG_CONTENT_TYPE, sizeof(TAG_CONTENT_TYPE) - 1)) { - if (!strncasecmp(this->buf + sizeof(TAG_CONTENT_TYPE) - 1, "video/nsv", 9)) { + const char *type = this->buf + sizeof (TAG_CONTENT_TYPE) - 1; + while (isspace (*type)) + ++type; + if (!strncasecmp (type, "video/nsv", 9)) { lprintf("shoutcast nsv detected\n"); this->is_nsv = 1; } -- cgit v1.2.3 From abf81e0f348655b62a3e784572c269aab5c8e352 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 11 Jun 2008 18:19:51 +0100 Subject: Fix va_list-related breakage. Multiple use needs va_copy(). --- src/input/vcd/xine-extra.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/input/vcd/xine-extra.c b/src/input/vcd/xine-extra.c index 79c962a79..e3b6da912 100644 --- a/src/input/vcd/xine-extra.c +++ b/src/input/vcd/xine-extra.c @@ -45,8 +45,10 @@ static xine_t *my_xine = NULL; void xine_vlog_msg(xine_t *this, int buf, const char *format, va_list args) { + va_list copy; + va_copy (copy, args); xine_vlog(this, buf, format, args); - vfprintf(stdout, format, args); + vfprintf(stdout, format, copy); } /*! This routine is like xine_log, except it takes a va_list instead @@ -59,8 +61,10 @@ xine_vlog_msg(xine_t *this, int buf, const char *format, va_list args) void xine_vlog_err(xine_t *this, int buf, const char *format, va_list args) { + va_list copy; + va_copy (copy, args); xine_vlog(this, buf, format, args); - vfprintf(stderr, format, args); + vfprintf(stderr, format, copy); } /*! Call this before calling any of the xine_log_msg or xine_log_err @@ -116,8 +120,8 @@ xine_log_err(const char *format, ...) { va_list args; - va_start(args, format); if (NULL == my_xine) return false; + va_start(args, format); xine_vlog_err(my_xine, XINE_LOG_MSG, format, args); va_end(args); return true; -- cgit v1.2.3 From acc0fe7a56ffdfa0ca359ba4a18fe7381933dbc5 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 11 Jun 2008 19:11:04 +0100 Subject: Provide a useful implementation of xine_register_log_cb(). --- src/xine-engine/xine.c | 14 +++++++++----- src/xine-engine/xine_internal.h | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 46d3b424f..984b6ade9 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -2229,7 +2229,10 @@ void xine_log (xine_t *this, int buf, const char *format, ...) { vsnprintf(buffer, SCRATCH_LINE_LEN_MAX, format, argp); printf("%s", buffer); va_end (argp); - } + } + + if (this->log_cb) + this->log_cb (this->log_cb_user_data, buf); } void xine_vlog(xine_t *this, int buf, const char *format, @@ -2238,6 +2241,9 @@ void xine_vlog(xine_t *this, int buf, const char *format, check_log_alloc (this, buf); this->log_buffers[buf]->scratch_printf(this->log_buffers[buf], format, args); + + if (this->log_cb) + this->log_cb (this->log_cb_user_data, buf); } char *const *xine_get_log (xine_t *this, int buf) { @@ -2252,12 +2258,10 @@ char *const *xine_get_log (xine_t *this, int buf) { } void xine_register_log_cb (xine_t *this, xine_log_cb_t cb, void *user_data) { - - printf ("xine: xine_register_log_cb: not implemented yet.\n"); - _x_abort(); + this->log_cb = cb; + this->log_cb_user_data = user_data; } - int xine_get_error (xine_stream_t *stream) { return stream->err; } diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 85f3d6489..f97ca0b24 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -117,6 +117,9 @@ struct xine_s { #ifdef XINE_ENGINE_INTERNAL xine_ticket_t *port_ticket; pthread_mutex_t log_lock; + + xine_log_cb_t log_cb; + void *log_cb_user_data; #endif }; -- cgit v1.2.3