summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruid86226 <none@none>2004-02-16 20:19:09 +0000
committeruid86226 <none@none>2004-02-16 20:19:09 +0000
commit5807b51c46b31abe0fecedb8f1a783f2bd74a18d (patch)
treedb5924af7c3bf12972a2e99854a76b8914d1fb99
parent76b4bde43bb287a9b4cbfe92b4af5e1dd40ee311 (diff)
downloadxine-lib-5807b51c46b31abe0fecedb8f1a783f2bd74a18d.tar.gz
xine-lib-5807b51c46b31abe0fecedb8f1a783f2bd74a18d.tar.bz2
fix freezes with input plugins that play with the speed:
* use _x_set_speed() for speed manipulations, since it is ticket-safe * _x_set_speed() is an internal helper function now, move frontend locking outside of it * restrict access to metronom clock internal stuff CVS patchset: 6165 CVS date: 2004/02/16 20:19:09
-rw-r--r--src/dxr3/dxr3_decode_video.c8
-rw-r--r--src/input/input_pvr.c10
-rw-r--r--src/input/input_v4l.c4
-rw-r--r--src/input/net_buf_ctrl.c4
-rw-r--r--src/xine-engine/metronom.c3
-rw-r--r--src/xine-engine/metronom.h29
-rw-r--r--src/xine-engine/xine.c7
-rw-r--r--src/xine-engine/xine_interface.c4
8 files changed, 42 insertions, 27 deletions
diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c
index e9e401a95..3b8a8270e 100644
--- a/src/dxr3/dxr3_decode_video.c
+++ b/src/dxr3/dxr3_decode_video.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: dxr3_decode_video.c,v 1.51 2004/01/12 17:35:15 miguelfreitas Exp $
+ * $Id: dxr3_decode_video.c,v 1.52 2004/02/16 20:19:09 uid86226 Exp $
*/
/* dxr3 video decoder plugin.
@@ -517,12 +517,6 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf)
time = clock->get_current_time(clock);
this->scr->scr_plugin.start(&this->scr->scr_plugin, time);
clock->register_scr(clock, &this->scr->scr_plugin);
-#if LOG_VID
- if (this->class->clock->scr_master == &this->scr->scr_plugin)
- printf("dxr3_decode_video: dxr3_scr plugin is master\n");
- else
- printf("dxr3_decode_video: dxr3scr plugin is NOT master\n");
-#endif
}
/* update the pts timestamp in the card, which tags the data we write to it */
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 8b47c9747..32a7aa632 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -38,7 +38,7 @@
* usage:
* xine pvr:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age>
*
- * $Id: input_pvr.c,v 1.41 2004/02/12 18:09:20 mroi Exp $
+ * $Id: input_pvr.c,v 1.42 2004/02/16 20:19:09 uid86226 Exp $
*/
/**************************************************************************
@@ -460,7 +460,7 @@ static void pvr_adjust_realtime_speed(pvr_input_plugin_t *this, fifo_buffer_t *f
this->scr_tunning = -2; /* marked as paused */
pvrscr_speed_tunning(this->scr, 1.0);
this->speed_before_pause = speed;
- this->stream->xine->clock->set_speed ( this->stream->xine->clock, XINE_SPEED_PAUSE);
+ _x_set_speed(this->stream, XINE_SPEED_PAUSE);
#ifdef SCRLOG
printf("input_pvr: buffer empty, pausing playback\n" );
#endif
@@ -472,7 +472,7 @@ static void pvr_adjust_realtime_speed(pvr_input_plugin_t *this, fifo_buffer_t *f
this->scr_tunning = 0;
pvrscr_speed_tunning(this->scr, 1.0 );
- this->stream->xine->clock->set_speed ( this->stream->xine->clock, this->speed_before_pause);
+ _x_set_speed(this->stream, this->speed_before_pause);
#ifdef SCRLOG
printf("input_pvr: resuming playback\n" );
#endif
@@ -674,7 +674,7 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t
this->play_blk = (this->rec_blk) ? (this->rec_blk-1) : 0;
if( speed > XINE_SPEED_NORMAL )
- this->stream->xine->clock->set_speed (this->stream->xine->clock, XINE_SPEED_NORMAL);
+ _x_set_speed(this->stream, XINE_SPEED_NORMAL);
if( this->play_fd != -1 ) {
if(this->play_fd != this->rec_fd )
@@ -977,7 +977,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
case XINE_EVENT_SET_V4L2:
/* make sure we are not paused */
- this->stream->xine->clock->set_speed ( this->stream->xine->clock, XINE_SPEED_NORMAL);
+ _x_set_speed(this->stream, XINE_SPEED_NORMAL);
if( v4l2_data->session_id != this->session ) {
/* if session changes -> closes the old one */
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
index 2de46b2fd..117c2c411 100644
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -1175,7 +1175,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi
"Buffer is empty, pausing playback (used: %d, num_free: %d)\r\n",
num_used, num_free);
- this->stream->xine->clock->set_speed (this->stream->xine->clock, XINE_SPEED_PAUSE);
+ _x_set_speed(this->stream, XINE_SPEED_PAUSE);
this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0);
this->scr_tunning = SCR_PAUSED;
@@ -1196,7 +1196,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi
pvrscr_speed_tunning(this->scr, 1.0);
- this->stream->xine->clock->set_speed (this->stream->xine->clock, XINE_SPEED_NORMAL);
+ _x_set_speed(this->stream, XINE_SPEED_NORMAL);
this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1);
}
} else if (scr_tunning == SCR_SKIP) {
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c
index e5b720a55..b8d44a3b3 100644
--- a/src/input/net_buf_ctrl.c
+++ b/src/input/net_buf_ctrl.c
@@ -99,13 +99,13 @@ static void report_progress (xine_stream_t *stream, int p) {
static void nbc_set_speed_pause (xine_stream_t *stream) {
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n");
- stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_PAUSE);
+ _x_set_speed(stream, XINE_SPEED_PAUSE);
stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0);
}
static void nbc_set_speed_normal (xine_stream_t *stream) {
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n");
- stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_NORMAL);
+ _x_set_speed(stream, XINE_SPEED_NORMAL);
stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1);
}
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index b301fdd25..acf96cab7 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.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: metronom.c,v 1.134 2004/01/18 18:18:31 mroi Exp $
+ * $Id: metronom.c,v 1.135 2004/02/16 20:19:09 uid86226 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,6 +41,7 @@
*/
#define METRONOM_INTERNAL
+#define METRONOM_CLOCK_INTERNAL
#include "xine_internal.h"
#include "metronom.h"
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index 2f14f0388..9a0019692 100644
--- a/src/xine-engine/metronom.h
+++ b/src/xine-engine/metronom.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: metronom.h,v 1.56 2003/11/20 00:42:14 tmattern Exp $
+ * $Id: metronom.h,v 1.57 2004/02/16 20:19:10 uid86226 Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -237,6 +237,7 @@ struct metronom_s {
metronom_t *_x_metronom_init (int have_video, int have_audio, xine_t *xine);
+/* FIXME: reorder this structure on the next cleanup to remove the dummies */
struct metronom_clock_s {
/*
@@ -249,6 +250,7 @@ struct metronom_clock_s {
* system clock reference (SCR) functions
*/
+#ifdef METRONOM_CLOCK_INTERNAL
/*
* start clock (no clock reset)
* at given pts
@@ -266,6 +268,11 @@ struct metronom_clock_s {
* resume clock from where it was stopped
*/
void (*resume_clock) (metronom_clock_t *self);
+#else
+ void *dummy1;
+ void *dummy2;
+ void *dummy3;
+#endif
/*
@@ -279,13 +286,16 @@ struct metronom_clock_s {
*/
void (*adjust_clock) (metronom_clock_t *self, int64_t desired_pts);
-
+#ifdef METRONOM_CLOCK_INTERNAL
/*
* set clock speed
* for constants see xine_internal.h
*/
int (*set_speed) (metronom_clock_t *self, int speed);
+#else
+ void *dummy4;
+#endif
/*
* (un)register a System Clock Reference provider at the metronom
@@ -293,6 +303,7 @@ struct metronom_clock_s {
int (*register_scr) (metronom_clock_t *self, scr_plugin_t *scr);
void (*unregister_scr) (metronom_clock_t *self, scr_plugin_t *scr);
+#ifdef METRONOM_CLOCK_INTERNAL
void (*exit) (metronom_clock_t *self);
xine_t *xine;
@@ -302,12 +313,22 @@ struct metronom_clock_s {
pthread_t sync_thread;
int thread_running;
int scr_adjustable;
+#else
+ void *dummy5;
+ void *dummy6;
+ void *dummy7;
+ void *dummy8;
+ pthread_t dummy9;
+ int dummy10;
+ int dummy11;
+#endif
int speed;
-
+
+#ifdef METRONOM_CLOCK_INTERNAL
pthread_mutex_t lock;
pthread_cond_t cancel;
-
+#endif
};
metronom_clock_t *_x_metronom_clock_init(xine_t *xine);
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 9564c8d25..282cc2db3 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.282 2004/02/15 20:31:23 mroi Exp $
+ * $Id: xine.c,v 1.283 2004/02/16 20:19:10 uid86226 Exp $
*/
/*
@@ -54,6 +54,7 @@
#define XINE_ENABLE_EXPERIMENTAL_FEATURES
#define XINE_ENGINE_INTERNAL
+#define METRONOM_CLOCK_INTERNAL
#include "xine_internal.h"
#include "plugin_catalog.h"
@@ -1539,8 +1540,6 @@ int xine_get_status (xine_stream_t *stream) {
void _x_set_speed (xine_stream_t *stream, int speed) {
- pthread_mutex_lock (&stream->frontend_lock);
-
if (speed <= XINE_SPEED_PAUSE)
speed = XINE_SPEED_PAUSE;
else if (speed > XINE_SPEED_FAST_4)
@@ -1551,8 +1550,6 @@ void _x_set_speed (xine_stream_t *stream, int speed) {
if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_SPEED))
__set_speed_internal (stream->slave, speed);
-
- pthread_mutex_unlock (&stream->frontend_lock);
}
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index e1a8abcb0..9ea2ffbd5 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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_interface.c,v 1.78 2004/02/12 18:19:12 mroi Exp $
+ * $Id: xine_interface.c,v 1.79 2004/02/16 20:19:10 uid86226 Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -329,7 +329,9 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
switch (param) {
case XINE_PARAM_SPEED:
+ pthread_mutex_lock (&stream->frontend_lock);
_x_set_speed (stream, value);
+ pthread_mutex_unlock (&stream->frontend_lock);
break;
case XINE_PARAM_AV_OFFSET: