From 596bada7527edc65502fc7f3f52535d3e92554ba Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Mon, 28 May 2001 01:28:10 +0000 Subject: use thread compliant signal handling. Fixed deadlock in xine_stop(). Fixed elementary demuxer (and perhaps mpgaudio too). Fix some code error in ac3/xine_decoder.c. CVS patchset: 87 CVS date: 2001/05/28 01:28:10 --- src/demuxers/demux_elem.c | 7 +++---- src/demuxers/demux_mpgaudio.c | 8 +++----- src/libac3/xine_decoder.c | 10 +++++----- src/video_out/Makefile.am | 2 +- src/xine-engine/video_out.c | 18 ++++++++---------- src/xine-engine/xine.c | 6 +++--- 6 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index dbd38b8e3..f64dd4b0f 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_elem.c,v 1.6 2001/05/24 23:15:40 f1rmb Exp $ + * $Id: demux_elem.c,v 1.7 2001/05/28 01:28:10 f1rmb Exp $ * * demultiplexer for elementary mpeg streams * @@ -71,15 +71,13 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this) { return 0; } - buf->content = buf->mem; buf->DTS = 0; buf->PTS = 0; - buf->size = this->input->read(this->input, buf->mem, this->blocksize); buf->input_pos = this->input->seek(this->input, 0, SEEK_CUR); buf->type = BUF_VIDEO_MPEG; this->video_fifo->put(this->video_fifo, buf); - + return (buf->size == this->blocksize); } @@ -159,6 +157,7 @@ static void demux_mpeg_elem_start (demux_plugin_t *this_gen, buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_CONTROL_START; this->video_fifo->put (this->video_fifo, buf); + buf = this->audio_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_CONTROL_START; this->audio_fifo->put (this->audio_fifo, buf); diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 71b2946cf..010fed8c3 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.5 2001/05/24 23:15:40 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.6 2001/05/28 01:28:10 f1rmb Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -230,21 +230,19 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this) { buf_element_t *buf; buf = this->input->read_block(this->input, - this->video_fifo, 2048); + this->audio_fifo, 2048); if (buf == NULL) { this->status = DEMUX_FINISHED; return 0; } - buf->content = buf->mem; buf->DTS = 0; buf->PTS = 0; - buf->size = this->input->read(this->input, buf->mem, 2048); buf->input_pos = this->input->seek(this->input, 0, SEEK_CUR); buf->type = BUF_AUDIO_AVI; - this->video_fifo->put(this->video_fifo, buf); + this->audio_fifo->put(this->audio_fifo, buf); return (buf->size == 2048); } diff --git a/src/libac3/xine_decoder.c b/src/libac3/xine_decoder.c index 5b9ab7ef6..065e2c4eb 100644 --- a/src/libac3/xine_decoder.c +++ b/src/libac3/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.3 2001/05/27 23:48:12 guenter Exp $ + * $Id: xine_decoder.c,v 1.4 2001/05/28 01:28:11 f1rmb Exp $ * * stuff needed to turn libac3 into a xine decoder plugin */ @@ -105,8 +105,8 @@ void ac3dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint8_t *current = buf->content; uint8_t *end = buf->content + buf->size; ac3_frame_t *ac3_frame; - int sampling_rate; - int output_mode; +/* int sampling_rate; */ + int output_mode = AO_CAP_MODE_STEREO; uint8_t byte; @@ -215,13 +215,13 @@ void ac3dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->output_open = (this->audio_out->open (this->audio_out, 16, ac3_sampling_rate(this->frame_buffer), AO_CAP_MODE_AC3) == 1); - this->output_mode - AO_CAP_MODE_AC3; + this->output_mode = AO_CAP_MODE_AC3; } if (this->output_open) { this->audio_out->write_audio_data (this->audio_out, - this->frame_buffer, + (int16_t*)this->frame_buffer, this->frame_length, this->pts); this->pts = 0; diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 179e1e263..03eeda614 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -36,7 +36,7 @@ noinst_HEADERS = yuv2rgb.h video_out_syncfb.h include_HEADERS = video_out_x11.h debug: - $(MAKE) CFLAGS="$(DEBUG_CFLAGS)" + $(MAKE) CFLAGS="$(DEBUG_CFLAGS) -DXINE_COMPILE" install-debug: debug @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index ce6092a0d..70a37813a 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.10 2001/05/27 23:48:12 guenter Exp $ + * $Id: video_out.c,v 1.11 2001/05/28 01:28:11 f1rmb Exp $ * */ @@ -115,12 +115,6 @@ static vo_frame_t *vo_remove_from_img_buf_queue (img_buf_fifo_t *queue) { return img; } -static void video_timer_handler (int hubba) { - - signal (SIGALRM, video_timer_handler); - -} - static void vo_set_timer (uint32_t video_step) { struct itimerval tval; @@ -143,17 +137,21 @@ static void *video_out_loop (void *this_gen) { vo_frame_t *img; uint32_t video_step, video_step_new; vo_instance_t *this = (vo_instance_t *) this_gen; - + sigset_t vo_mask; + int dummysignum; + /* printf ("%d video_out start\n", getpid()); */ - signal (SIGALRM, video_timer_handler); + sigemptyset(&vo_mask); + sigaddset(&vo_mask, SIGALRM); + pthread_sigmask(SIG_BLOCK, &vo_mask, NULL); video_step = this->metronom->get_video_rate (this->metronom); vo_set_timer (video_step); while (this->video_loop_running) { - pause (); /* wait for next timer tick */ + sigwait(&vo_mask, &dummysignum); /* wait for next timer tick */ video_step_new = this->metronom->get_video_rate (this->metronom); if (video_step_new != video_step) { diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index cbbb13a6c..6dd68199c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.17 2001/05/26 20:47:14 siggi Exp $ + * $Id: xine.c,v 1.18 2001/05/28 01:28:11 f1rmb Exp $ * * top-level xine functions * @@ -72,10 +72,10 @@ void xine_notify_stream_finished (xine_t *this) { */ void xine_stop (xine_t *this) { - pthread_mutex_lock (&this->xine_lock); - if (!this->cur_input_plugin) return; + + pthread_mutex_lock (&this->xine_lock); this->status = XINE_STOP; -- cgit v1.2.3