summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/audio_decoder.c4
-rw-r--r--src/xine-engine/audio_out.c57
-rw-r--r--src/xine-engine/audio_out.h3
-rw-r--r--src/xine-engine/video_out.c11
-rw-r--r--src/xine-engine/video_out.h3
-rw-r--r--src/xine-engine/xine.c17
-rw-r--r--src/xine-engine/xine_internal.h3
7 files changed, 62 insertions, 36 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 019231b0e..b2bc1ac89 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.55 2001/11/17 14:26:39 f1rmb Exp $
+ * $Id: audio_decoder.c,v 1.56 2001/11/20 12:41:57 miguelfreitas Exp $
*
*
* functions that implement audio decoding
@@ -157,6 +157,7 @@ void *audio_decoder_loop (void *this_gen) {
default:
+#if 0
while (this->audio_mute==2) {
xine_usec_sleep (50000);
}
@@ -168,6 +169,7 @@ void *audio_decoder_loop (void *this_gen) {
*/
break;
}
+#endif
xine_profiler_start_count (prof_audio_decode);
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 2e648107f..69c652a79 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.34 2001/11/19 19:10:41 miguelfreitas Exp $
+ * $Id: audio_out.c,v 1.35 2001/11/20 12:41:57 miguelfreitas Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -293,7 +293,8 @@ static void *ao_loop (void *this_gen) {
uint32_t ac5_type;
uint32_t ac5_length;
uint32_t ac5_pcm_length;
-
+ int paused_wait;
+
this->audio_loop_running = 1;
while ((this->audio_loop_running) ||
@@ -306,33 +307,46 @@ static void *ao_loop (void *this_gen) {
buf = fifo_remove (this->out_fifo);
- delay = this->driver->delay(this->driver);
+ do {
+ delay = this->driver->delay(this->driver);
- /*
- * where, in the timeline is the "end" of the
- * hardware audio buffer at the moment?
- */
+ /*
+ * where, in the timeline is the "end" of the
+ * hardware audio buffer at the moment?
+ */
- cur_time = this->metronom->get_current_time (this->metronom);
- hw_vpts = cur_time;
+ cur_time = this->metronom->get_current_time (this->metronom);
+ hw_vpts = cur_time;
#ifdef AUDIO_OUT_LOG
- printf ("audio_out: current delay is %d, current time is %d\n",
+ printf ("audio_out: current delay is %d, current time is %d\n",
delay, cur_time);
#endif
- /* External A52 decoder delay correction */
- if ((this->mode==AO_CAP_MODE_A52) || (this->mode==AO_CAP_MODE_AC5))
- delay+=10;
+ /* External A52 decoder delay correction */
+ if ((this->mode==AO_CAP_MODE_A52) || (this->mode==AO_CAP_MODE_AC5))
+ delay+=10;
- hw_vpts += delay * 1024 / this->frames_per_kpts;
+ hw_vpts += delay * 1024 / this->frames_per_kpts;
- /*
- * calculate gap:
- */
-
- gap = buf->vpts - hw_vpts;
+ /*
+ * calculate gap:
+ */
+ gap = buf->vpts - hw_vpts;
+
+ /* wait until user unpauses stream
+ audio_paused == 1 means we are playing at a different speed
+ them we must process buffers otherwise the entire engine will stop.
+ */
+ paused_wait = (this->audio_paused == 2) ||
+ (this->audio_paused && gap > this->gap_tolerance);
+
+ if ( paused_wait )
+ xine_usec_sleep (50000);
+ } while ( paused_wait );
+
+
/*
printf ("vpts : %d buffer_vpts : %d gap %d\n",
hw_vpts, buf->vpts, gap);
@@ -342,7 +356,8 @@ static void *ao_loop (void *this_gen) {
* output audio data synced to master clock
*/
- if (gap < (-1 * this->gap_tolerance) || !buf->num_frames) {
+ if (gap < (-1 * this->gap_tolerance) || !buf->num_frames ||
+ this->audio_paused ) {
/* drop package */
@@ -629,6 +644,7 @@ static void ao_close(ao_instance_t *this) {
void *p;
this->audio_loop_running = 0;
+ this->audio_paused = 0;
audio_buffer = fifo_remove(this->free_fifo);
audio_buffer->num_frames = 0;
@@ -684,6 +700,7 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom,
this->get_property = ao_get_property;
this->set_property = ao_set_property;
this->audio_loop_running = 0;
+ this->audio_paused = 0;
/* FIXME: is 4* good enough for all resample cases?? */
this->frame_buffer = xine_xmalloc (4 * AUDIO_BUF_SIZE);
this->zero_space = xine_xmalloc (ZERO_BUF_SIZE * 2 * 6);
diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h
index 86ae13484..a3f1c65e2 100644
--- a/src/xine-engine/audio_out.h
+++ b/src/xine-engine/audio_out.h
@@ -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: audio_out.h,v 1.20 2001/11/10 13:48:03 guenter Exp $
+ * $Id: audio_out.h,v 1.21 2001/11/20 12:41:58 miguelfreitas Exp $
*/
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H
@@ -181,6 +181,7 @@ struct ao_instance_s {
metronom_t *metronom;
int audio_loop_running;
+ int audio_paused;
pthread_t audio_thread;
int audio_step; /* pts per 32 768 samples (sample = #bytes/2) */
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index ad8cb6df9..920b69577 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.56 2001/11/18 03:53:25 guenter Exp $
+ * $Id: video_out.c,v 1.57 2001/11/20 12:41:58 miguelfreitas Exp $
*
*/
@@ -192,14 +192,17 @@ static void *video_out_loop (void *this_gen) {
/* sigwait(&vo_mask, &dummysignum); */ /* wait for next timer tick */
pause ();
- xine_profiler_start_count (prof_video_out);
-
+ if( this->video_paused )
+ continue;
+
video_step_new = this->metronom->get_video_rate (this->metronom);
if (video_step_new != video_step) {
video_step = video_step_new;
vo_set_timer (video_step);
}
pts_absdiff = 1000000;
+
+ xine_profiler_start_count (prof_video_out);
cur_pts = this->metronom->get_current_time (this->metronom);
@@ -410,6 +413,7 @@ static void vo_close (vo_instance_t *this) {
void *p;
this->video_loop_running = 0;
+ this->video_paused = 0;
/*kill (0, SIGALRM);*/
pthread_join (this->video_thread, &p);
}
@@ -608,6 +612,7 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
this->free_img_buf_queue = vo_new_img_buf_queue ();
this->display_img_buf_queue = vo_new_img_buf_queue ();
this->video_loop_running = 0;
+ this->video_paused = 0;
this->pts_per_frame = 0;
this->pts_per_half_frame = 0;
this->overlay_enabled = 1;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index c6467c1ec..8e4ac0828 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -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.h,v 1.29 2001/11/15 23:18:04 guenter Exp $
+ * $Id: video_out.h,v 1.30 2001/11/20 12:41:58 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -155,6 +155,7 @@ struct vo_instance_s {
vo_frame_t *last_frame;
int video_loop_running;
+ int video_paused;
pthread_t video_thread;
int pts_per_half_frame;
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 89329a9e8..7239063a0 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.76 2001/11/18 03:53:25 guenter Exp $
+ * $Id: xine.c,v 1.77 2001/11/20 12:41:58 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -106,7 +106,8 @@ void xine_stop (xine_t *this) {
this->metronom->set_speed (this->metronom, SPEED_NORMAL);
this->speed = SPEED_NORMAL;
- this->audio_mute = 0;
+ this->video_out->video_paused = 0;
+ this->audio_out->audio_paused = 0;
this->status = XINE_STOP;
printf ("xine_stop: stopping demuxer\n");
@@ -304,7 +305,8 @@ void xine_play (xine_t *this, char *mrl,
strncpy (this->cur_mrl, mrl, 1024);
this->metronom->set_speed (this->metronom, SPEED_NORMAL);
- this->audio_mute = 0;
+ this->video_out->video_paused = 0;
+ this->audio_out->audio_paused = 0;
this->speed = SPEED_NORMAL;
}
@@ -363,7 +365,6 @@ void xine_exit (xine_t *this) {
printf ("xine_exit: shutdown audio\n");
- this->audio_mute = 1;
audio_decoder_shutdown (this);
printf ("xine_exit: shutdown video\n");
@@ -581,10 +582,10 @@ void xine_set_speed (xine_t *this, int speed) {
this->metronom->set_speed (this->metronom, speed);
- if (speed == SPEED_PAUSE)
- this->audio_mute = 2;
- else
- this->audio_mute = speed != SPEED_NORMAL;
+ this->video_out->video_paused = (speed == SPEED_PAUSE);
+ /* see coment on audio_out loop about audio_paused */
+ this->audio_out->audio_paused = (speed != SPEED_NORMAL) +
+ (speed == SPEED_PAUSE);
this->speed = speed;
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 99e37b546..ad8403b7d 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -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_internal.h,v 1.55 2001/11/15 23:18:04 guenter Exp $
+ * $Id: xine_internal.h,v 1.56 2001/11/20 12:41:58 miguelfreitas Exp $
*
*/
@@ -192,7 +192,6 @@ struct xine_s {
uint32_t audio_track_map[50];
int audio_track_map_entries;
int audio_finished;
- int audio_mute;
uint32_t audio_type;
/* Lock for xine player functions */