summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2009-01-02 22:35:57 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2009-01-02 22:35:57 +0000
commita251dc779c6eaf0d29b126b02877fc10838aaec0 (patch)
tree364c90119fea42cd28016305b7768696243dc680 /src
parent852aff94b4586982ff33bf21471cda90124a65bf (diff)
parentefaeb575230625611f3f5fc1f9eae2b36d375fea (diff)
downloadxine-lib-a251dc779c6eaf0d29b126b02877fc10838aaec0.tar.gz
xine-lib-a251dc779c6eaf0d29b126b02877fc10838aaec0.tar.bz2
Merge from 1.1.
--HG-- rename : include/xine.h.in => include/xine.h rename : src/libspudvb/xine_spudvb_decoder.c => src/spu_dec/spudvb_decoder.c
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_audio_decoder.c5
-rw-r--r--src/input/mms.c14
-rw-r--r--src/xine-engine/demux.c28
3 files changed, 44 insertions, 3 deletions
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c
index e12778fc7..a3c61b097 100644
--- a/src/combined/ffmpeg/ff_audio_decoder.c
+++ b/src/combined/ffmpeg/ff_audio_decoder.c
@@ -366,6 +366,11 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
/* dispatch the decoded audio */
out = 0;
while (out < decode_buffer_size) {
+ int stream_status = xine_get_status(this->stream);
+
+ if (stream_status == XINE_STATUS_QUIT || stream_status == XINE_STATUS_STOP)
+ return;
+
audio_buffer =
this->stream->audio_out->get_buffer (this->stream->audio_out);
if (audio_buffer->mem_size == 0) {
diff --git a/src/input/mms.c b/src/input/mms.c
index 812e2ed43..c3cc15401 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) {
@@ -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/xine-engine/demux.c b/src/xine-engine/demux.c
index 5e1bb0ff0..59de9381e 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -138,6 +138,28 @@ void _x_demux_control_newpts( xine_stream_t *stream, int64_t pts, uint32_t flags
pthread_mutex_unlock(&stream->demux_mutex);
}
+/* avoid ao_loop being stuck in a pthread_cond_wait, waiting for data;
+ * return 1 if the stream is stopped
+ * (better fix wanted!)
+ */
+static int demux_unstick_ao_loop (xine_stream_t *stream)
+{
+ if (!stream->audio_thread_created)
+ return 0;
+
+ int status = xine_get_status (stream);
+ if (status != XINE_STATUS_QUIT && status != XINE_STATUS_STOP)
+ return 0;
+
+ /* right, stream is stopped... */
+ audio_buffer_t *buf = stream->audio_out->get_buffer (stream->audio_out);
+ buf->num_frames = 0;
+ buf->stream = NULL;
+ stream->audio_out->put_buffer (stream->audio_out, buf, stream);
+
+ return 1;
+}
+
/* sync with decoder fifos, making sure everything gets processed */
void _x_demux_control_headers_done (xine_stream_t *stream) {
@@ -190,6 +212,9 @@ void _x_demux_control_headers_done (xine_stream_t *stream) {
ts.tv_nsec = tv.tv_usec * 1000;
/* use timedwait to workaround buggy pthread broadcast implementations */
pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts);
+
+ if (demux_unstick_ao_loop (stream))
+ break;
}
stream->demux_action_pending = 0;
@@ -347,6 +372,9 @@ static void *demux_loop (void *stream_gen) {
(stream->finished_count_video < finished_count_video)) {
lprintf ("waiting for finisheds.\n");
pthread_cond_wait (&stream->counter_changed, &stream->counter_lock);
+
+ if (demux_unstick_ao_loop (stream))
+ break;
}
pthread_mutex_unlock (&stream->counter_lock);