summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-08-02 12:51:07 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-08-02 12:51:07 +0000
commit2e2b861d367f376a67c86b7381132d5e1097d999 (patch)
tree8c3e4b9b5194e969424b964a600bdb2217d31d97
parent9d4bd66d0f07ee930e6566a4053933de23fb6515 (diff)
downloadxine-lib-2e2b861d367f376a67c86b7381132d5e1097d999.tar.gz
xine-lib-2e2b861d367f376a67c86b7381132d5e1097d999.tar.bz2
no objections so far: committing the fine speed control patch
(in case of major trouble just revert the patch i sent to xine-devel) CVS patchset: 6871 CVS date: 2004/08/02 12:51:07
-rw-r--r--ChangeLog1
-rw-r--r--include/xine.h.in14
-rw-r--r--src/dxr3/dxr3_scr.c10
-rw-r--r--src/input/input_pvr.c16
-rw-r--r--src/input/input_v4l.c10
-rw-r--r--src/post/audio/stretch.c10
-rw-r--r--src/xine-engine/audio_out.c4
-rw-r--r--src/xine-engine/metronom.c26
-rw-r--r--src/xine-engine/metronom.h6
-rw-r--r--src/xine-engine/xine.c54
-rw-r--r--src/xine-engine/xine_interface.c14
-rw-r--r--src/xine-engine/xine_internal.h8
12 files changed, 119 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index 96dc65936..26f6137ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@ xine-lib (1-rc6)
slower than original speed, optionally preserving pitch
* another win32 dll crash fix (after playing several files)
* configure option for building xine with external ffmpeg library
+ * added api for finer playback speed control (requires frontend support)
xine-lib (1-rc5)
* add support for ejecting removable media on Solaris
diff --git a/include/xine.h.in b/include/xine.h.in
index 041bf3518..d88516d6d 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -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.h.in,v 1.126 2004/07/19 19:53:40 miguelfreitas Exp $
+ * $Id: xine.h.in,v 1.127 2004/08/02 12:51:08 miguelfreitas Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -332,14 +332,24 @@ int xine_get_param (xine_stream_t *stream, int param);
#define XINE_PARAM_EQ_16000HZ 27 /* equalizer gains -100..100 */
#define XINE_PARAM_AUDIO_CLOSE_DEVICE 28 /* force closing audio device */
#define XINE_PARAM_AUDIO_AMP_MUTE 29 /* 1=>mute, 0=>unmute */
+#define XINE_PARAM_FINE_SPEED 30 /* 1.000.000 => normal speed */
-/* speed values */
+/*
+ * speed values for XINE_PARAM_SPEED parameter.
+ *
+ * alternatively, one may use XINE_PARAM_FINE_SPEED for greater
+ * control of the speed value, where:
+ * XINE_PARAM_SPEED / 4 <-> XINE_PARAM_FINE_SPEED / 1000000
+ */
#define XINE_SPEED_PAUSE 0
#define XINE_SPEED_SLOW_4 1
#define XINE_SPEED_SLOW_2 2
#define XINE_SPEED_NORMAL 4
#define XINE_SPEED_FAST_2 8
#define XINE_SPEED_FAST_4 16
+
+/* normal speed value for XINE_PARAM_FINE_SPEED parameter */
+#define XINE_FINE_SPEED_NORMAL 1000000
/* video parameters */
#define XINE_PARAM_VO_DEINTERLACE 0x01000000 /* bool */
diff --git a/src/dxr3/dxr3_scr.c b/src/dxr3/dxr3_scr.c
index bc60de491..e1490c182 100644
--- a/src/dxr3/dxr3_scr.c
+++ b/src/dxr3/dxr3_scr.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_scr.c,v 1.16 2004/07/20 16:37:44 mroi Exp $
+ * $Id: dxr3_scr.c,v 1.17 2004/08/02 12:51:08 miguelfreitas Exp $
*/
/* dxr3 scr plugin.
@@ -86,12 +86,12 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine)
this->xine = xine;
- this->scr_plugin.interface_version = 2;
+ this->scr_plugin.interface_version = 3;
this->scr_plugin.get_priority = dxr3_scr_get_priority;
this->scr_plugin.start = dxr3_scr_start;
this->scr_plugin.get_current = dxr3_scr_get_current;
this->scr_plugin.adjust = dxr3_scr_adjust;
- this->scr_plugin.set_speed = dxr3_scr_set_speed;
+ this->scr_plugin.set_fine_speed = dxr3_scr_set_speed;
this->scr_plugin.exit = dxr3_scr_exit;
this->priority = xine->config->register_num(
@@ -187,6 +187,8 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
dxr3_scr_t *this = (dxr3_scr_t *)scr;
uint32_t em_speed;
int playmode;
+
+ speed = speed * XINE_SPEED_NORMAL / XINE_FINE_SPEED_NORMAL;
pthread_mutex_lock(&this->mutex);
switch (speed) {
@@ -236,7 +238,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
pthread_mutex_unlock(&this->mutex);
lprintf("speed set to mode %d\n", speed);
- return speed;
+ return speed * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL;
}
static void dxr3_scr_exit(scr_plugin_t *scr)
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 5c4a75fc3..79e979f7d 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.48 2004/07/25 17:11:59 mroi Exp $
+ * $Id: input_pvr.c,v 1.49 2004/08/02 12:51:09 miguelfreitas Exp $
*/
/**************************************************************************
@@ -306,7 +306,7 @@ static int pvrscr_set_speed (scr_plugin_t *scr, int speed) {
pvrscr_set_pivot( this );
this->xine_speed = speed;
- this->speed_factor = (double) speed * 90000.0 / 4.0 *
+ this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL *
this->speed_tunning;
pthread_mutex_unlock (&this->lock);
@@ -319,7 +319,7 @@ static void pvrscr_speed_tunning (pvrscr_t *this, double factor) {
pvrscr_set_pivot( this );
this->speed_tunning = factor;
- this->speed_factor = (double) this->xine_speed * 90000.0 / 4.0 *
+ this->speed_factor = (double) this->xine_speed * 90000.0 / XINE_FINE_SPEED_NORMAL *
this->speed_tunning;
pthread_mutex_unlock (&this->lock);
@@ -349,7 +349,7 @@ static void pvrscr_start (scr_plugin_t *scr, int64_t start_vpts) {
pthread_mutex_unlock (&this->lock);
- pvrscr_set_speed (&this->scr, XINE_SPEED_NORMAL);
+ pvrscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL);
}
static int64_t pvrscr_get_current (scr_plugin_t *scr) {
@@ -384,9 +384,9 @@ static pvrscr_t* pvrscr_init (void) {
this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t));
- this->scr.interface_version = 2;
+ this->scr.interface_version = 3;
this->scr.get_priority = pvrscr_get_priority;
- this->scr.set_speed = pvrscr_set_speed;
+ this->scr.set_fine_speed = pvrscr_set_speed;
this->scr.adjust = pvrscr_adjust;
this->scr.start = pvrscr_start;
this->scr.get_current = pvrscr_get_current;
@@ -1128,7 +1128,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
case XINE_EVENT_PVR_PAUSE:
/* ignore event if trying to pause, but already paused */
- if(this->stream->xine->clock->speed != XINE_SPEED_PAUSE ||
+ if(_x_get_speed(this->stream) != XINE_SPEED_PAUSE ||
!pause_data->mode)
this->pvr_play_paused = pause_data->mode;
break;
@@ -1185,7 +1185,7 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff
pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen;
buf_element_t *buf;
- int speed = this->stream->xine->clock->speed;
+ int speed = _x_get_speed(this->stream);
if( !this->pvr_running ) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: thread died, aborting\n");
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
index 22aea7426..dcc797fde 100644
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -266,7 +266,7 @@ static int pvrscr_set_speed (scr_plugin_t *scr, int speed)
pvrscr_set_pivot( this );
this->xine_speed = speed;
- this->speed_factor = (double) speed * 90000.0 / 4.0 *
+ this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL *
this->speed_tunning;
pthread_mutex_unlock (&this->lock);
@@ -312,7 +312,7 @@ static void pvrscr_start (scr_plugin_t *scr, int64_t start_vpts)
pthread_mutex_unlock (&this->lock);
- pvrscr_set_speed (&this->scr, XINE_SPEED_NORMAL);
+ pvrscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL);
}
static int64_t pvrscr_get_current (scr_plugin_t *scr)
@@ -349,9 +349,9 @@ static pvrscr_t* pvrscr_init (void)
this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t));
- this->scr.interface_version = 2;
+ this->scr.interface_version = 3;
this->scr.get_priority = pvrscr_get_priority;
- this->scr.set_speed = pvrscr_set_speed;
+ this->scr.set_fine_speed = pvrscr_set_speed;
this->scr.adjust = pvrscr_adjust;
this->scr.start = pvrscr_start;
this->scr.get_current = pvrscr_get_current;
@@ -1228,7 +1228,7 @@ static buf_element_t *v4l_plugin_read_block (input_plugin_t *this_gen, fifo_buff
buf_element_t *buf = NULL;
uint8_t *ptr;
static char video = 0;
- int speed = this->stream->xine->clock->speed;
+ int speed = _x_get_speed(this->stream);
v4l_event_handler(this);
diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c
index f21378cd2..6eb131a2b 100644
--- a/src/post/audio/stretch.c
+++ b/src/post/audio/stretch.c
@@ -19,7 +19,7 @@
*
* Time stretch by a given factor, optionally preserving pitch
*
- * $Id: stretch.c,v 1.3 2004/07/27 17:59:58 mroi Exp $
+ * $Id: stretch.c,v 1.4 2004/08/02 12:51:11 miguelfreitas Exp $
*
*/
@@ -93,7 +93,7 @@ static int stretchscr_set_speed (scr_plugin_t *scr, int speed) {
stretchscr_set_pivot( this );
this->xine_speed = speed;
- this->speed_factor = (double) speed * 90000.0 / 4.0 /
+ this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL /
(*this->stretch_factor);
pthread_mutex_unlock (&this->lock);
@@ -125,7 +125,7 @@ static void stretchscr_start (scr_plugin_t *scr, int64_t start_vpts) {
pthread_mutex_unlock (&this->lock);
- stretchscr_set_speed (&this->scr, XINE_SPEED_NORMAL);
+ stretchscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL);
}
static int64_t stretchscr_get_current (scr_plugin_t *scr) {
@@ -160,9 +160,9 @@ static stretchscr_t* stretchscr_init (double *stretch_factor) {
this = (stretchscr_t *) xine_xmalloc(sizeof(stretchscr_t));
- this->scr.interface_version = 2;
+ this->scr.interface_version = 3;
this->scr.get_priority = stretchscr_get_priority;
- this->scr.set_speed = stretchscr_set_speed;
+ this->scr.set_fine_speed = stretchscr_set_speed;
this->scr.adjust = stretchscr_adjust;
this->scr.start = stretchscr_start;
this->scr.get_current = stretchscr_get_current;
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 49838df1a..381d33aef 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.182 2004/07/06 22:53:22 miguelfreitas Exp $
+ * $Id: audio_out.c,v 1.183 2004/08/02 12:51:11 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>
@@ -953,7 +953,7 @@ static void *ao_loop (void *this_gen) {
* we must process buffers otherwise the entire engine will stop.
*/
- if ( this->clock->speed != XINE_SPEED_NORMAL && this->audio_loop_running ) {
+ if ( this->clock->speed != XINE_FINE_SPEED_NORMAL && this->audio_loop_running ) {
if (this->clock->speed != XINE_SPEED_PAUSE) {
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 261b02d00..4098f30cb 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.139 2004/06/19 19:51:25 mroi Exp $
+ * $Id: metronom.c,v 1.140 2004/08/02 12:51:21 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -113,7 +113,7 @@ static int unixscr_set_speed (scr_plugin_t *scr, int speed) {
pthread_mutex_lock (&this->lock);
unixscr_set_pivot( this );
- this->speed_factor = (double) speed * 90000.0 / 4.0;
+ this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL;
pthread_mutex_unlock (&this->lock);
@@ -144,7 +144,7 @@ static void unixscr_start (scr_plugin_t *scr, int64_t start_vpts) {
pthread_mutex_unlock (&this->lock);
- unixscr_set_speed (&this->scr, XINE_SPEED_NORMAL);
+ unixscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL);
}
static int64_t unixscr_get_current (scr_plugin_t *scr) {
@@ -180,9 +180,9 @@ static scr_plugin_t* unixscr_init () {
this = (unixscr_t *) xine_xmalloc(sizeof(unixscr_t));
memset(this, 0, sizeof(*this));
- this->scr.interface_version = 2;
+ this->scr.interface_version = 3;
this->scr.get_priority = unixscr_get_priority;
- this->scr.set_speed = unixscr_set_speed;
+ this->scr.set_fine_speed = unixscr_set_speed;
this->scr.adjust = unixscr_adjust;
this->scr.start = unixscr_start;
this->scr.get_current = unixscr_get_current;
@@ -224,13 +224,13 @@ static int64_t metronom_get_current_time (metronom_clock_t *this) {
static void metronom_stop_clock(metronom_clock_t *this) {
scr_plugin_t** scr;
for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++)
- if (*scr) (*scr)->set_speed(*scr, XINE_SPEED_PAUSE);
+ if (*scr) (*scr)->set_fine_speed(*scr, XINE_SPEED_PAUSE);
}
static void metronom_resume_clock(metronom_clock_t *this) {
scr_plugin_t** scr;
for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++)
- if (*scr) (*scr)->set_speed(*scr, XINE_SPEED_NORMAL);
+ if (*scr) (*scr)->set_fine_speed(*scr, XINE_FINE_SPEED_NORMAL);
}
@@ -245,12 +245,12 @@ static int metronom_set_speed (metronom_clock_t *this, int speed) {
scr_plugin_t **scr;
int true_speed;
- true_speed = this->scr_master->set_speed (this->scr_master, speed);
+ true_speed = this->scr_master->set_fine_speed (this->scr_master, speed);
this->speed = true_speed;
for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++)
- if (*scr) (*scr)->set_speed(*scr, true_speed);
+ if (*scr) (*scr)->set_fine_speed(*scr, true_speed);
return true_speed;
}
@@ -812,7 +812,11 @@ static scr_plugin_t* get_master_scr(metronom_clock_t *this) {
static int metronom_register_scr (metronom_clock_t *this, scr_plugin_t *scr) {
int i;
- if (scr->interface_version != 2) return -1;
+ if (scr->interface_version != 3) {
+ xprintf(this->xine, XINE_VERBOSITY_NONE,
+ "wrong interface version for scr provider!\n");
+ return -1;
+ }
for (i=0; i<MAX_SCR_PROVIDERS; i++)
if (this->scr_list[i] == NULL) break;
@@ -970,7 +974,7 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine)
this->resume_clock = metronom_resume_clock;
this->get_current_time = metronom_get_current_time;
this->adjust_clock = metronom_adjust_clock;
- this->set_speed = metronom_set_speed;
+ this->set_fine_speed = metronom_set_speed;
this->register_scr = metronom_register_scr;
this->unregister_scr = metronom_unregister_scr;
this->exit = metronom_clock_exit;
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index 185b38b35..cf582850a 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.60 2004/06/19 19:53:29 mroi Exp $
+ * $Id: metronom.h,v 1.61 2004/08/02 12:51:21 miguelfreitas Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -286,7 +286,7 @@ struct metronom_clock_s {
* for constants see xine_internal.h
*/
- int (*set_speed) (metronom_clock_t *self, int speed);
+ int (*set_fine_speed) (metronom_clock_t *self, int speed);
#else
void *dummy4;
#endif
@@ -350,7 +350,7 @@ struct scr_plugin_s
* returns actual speed
*/
- int (*set_speed) (scr_plugin_t *self, int speed);
+ int (*set_fine_speed) (scr_plugin_t *self, int speed);
void (*adjust) (scr_plugin_t *self, int64_t vpts);
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index adda44141..04d3f8bab 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.295 2004/06/13 21:28:57 miguelfreitas Exp $
+ * $Id: xine.c,v 1.296 2004/08/02 12:51:21 miguelfreitas Exp $
*/
/*
@@ -250,7 +250,7 @@ static void __set_speed_internal (xine_stream_t *stream, int speed) {
/* all decoder and post threads may continue now */
xine->port_ticket->issue(xine->port_ticket, 0);
- stream->xine->clock->set_speed (stream->xine->clock, speed);
+ stream->xine->clock->set_fine_speed (stream->xine->clock, speed);
/* see coment on audio_out loop about audio_paused */
if( stream->audio_out ) {
@@ -260,7 +260,7 @@ static void __set_speed_internal (xine_stream_t *stream, int speed) {
* slow motion / fast forward does not play sound, drop buffered
* samples from the sound driver
*/
- if (speed != XINE_SPEED_NORMAL && speed != XINE_SPEED_PAUSE)
+ if (speed != XINE_FINE_SPEED_NORMAL && speed != XINE_SPEED_PAUSE)
stream->audio_out->control (stream->audio_out, AO_CTRL_FLUSH_BUFFERS, NULL);
stream->audio_out->control(stream->audio_out,
@@ -285,7 +285,7 @@ static void __stop_internal (xine_stream_t *stream) {
}
/* make sure we're not in "paused" state */
- __set_speed_internal (stream, XINE_SPEED_NORMAL);
+ __set_speed_internal (stream, XINE_FINE_SPEED_NORMAL);
/* Don't change status if we're quitting */
if (stream->status != XINE_STATUS_QUIT)
@@ -1097,8 +1097,8 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time
stream->demux_action_pending = 1;
/* set normal speed */
- if (stream->xine->clock->speed != XINE_SPEED_NORMAL)
- __set_speed_internal (stream, XINE_SPEED_NORMAL);
+ if (_x_get_speed(stream) != XINE_SPEED_NORMAL)
+ __set_speed_internal (stream, XINE_FINE_SPEED_NORMAL);
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1);
@@ -1116,8 +1116,8 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time
* some input plugin may have changed speed by itself, we must ensure
* the engine is not paused.
*/
- if (stream->xine->clock->speed != XINE_SPEED_NORMAL)
- __set_speed_internal (stream, XINE_SPEED_NORMAL);
+ if (_x_get_speed(stream) != XINE_SPEED_NORMAL)
+ __set_speed_internal (stream, XINE_FINE_SPEED_NORMAL);
/*
* start/seek demux
@@ -1589,15 +1589,13 @@ int xine_get_status (xine_stream_t *stream) {
* trick play
*/
-void _x_set_speed (xine_stream_t *stream, int speed) {
+void _x_set_fine_speed (xine_stream_t *stream, int speed) {
if (stream->ignore_speed_change)
return;
if (speed <= XINE_SPEED_PAUSE)
speed = XINE_SPEED_PAUSE;
- else if (speed > XINE_SPEED_FAST_4)
- speed = XINE_SPEED_FAST_4;
xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "set_speed %d\n", speed);
__set_speed_internal (stream, speed);
@@ -1606,6 +1604,40 @@ void _x_set_speed (xine_stream_t *stream, int speed) {
__set_speed_internal (stream->slave, speed);
}
+int _x_get_fine_speed (xine_stream_t *stream) {
+ return stream->xine->clock->speed;
+}
+
+void _x_set_speed (xine_stream_t *stream, int speed) {
+
+ if (speed > XINE_SPEED_FAST_4)
+ speed = XINE_SPEED_FAST_4;
+
+ _x_set_fine_speed (stream, speed * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL);
+}
+
+int _x_get_speed (xine_stream_t *stream) {
+ int speed = _x_get_fine_speed (stream);
+
+ /*
+ * ensure compatibility with old API, only valid XINE_SPEED_xxx
+ * constants are allowed. XINE_SPEED_NORMAL may only be returned
+ * if speed is exactly XINE_FINE_SPEED_NORMAL.
+ */
+
+ if( speed <= XINE_SPEED_PAUSE )
+ return XINE_SPEED_PAUSE;
+ if( speed <= XINE_SPEED_SLOW_4 * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL )
+ return XINE_SPEED_SLOW_4;
+ if( speed < XINE_FINE_SPEED_NORMAL )
+ return XINE_SPEED_SLOW_2;
+ if( speed == XINE_FINE_SPEED_NORMAL )
+ return XINE_SPEED_NORMAL;
+ if( speed <= XINE_SPEED_FAST_2 * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL )
+ return XINE_SPEED_FAST_2;
+ return XINE_SPEED_FAST_4;
+}
+
/*
* time measurement / seek
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index a04eec7e7..3567d9d4d 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.82 2004/05/07 14:38:14 mroi Exp $
+ * $Id: xine_interface.c,v 1.83 2004/08/02 12:51:21 miguelfreitas Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -333,6 +333,12 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
_x_set_speed (stream, value);
pthread_mutex_unlock (&stream->frontend_lock);
break;
+
+ case XINE_PARAM_FINE_SPEED:
+ pthread_mutex_lock (&stream->frontend_lock);
+ _x_set_fine_speed (stream, value);
+ pthread_mutex_unlock (&stream->frontend_lock);
+ break;
case XINE_PARAM_AV_OFFSET:
stream->metronom->set_option (stream->metronom, METRONOM_AV_OFFSET, value);
@@ -475,7 +481,11 @@ int xine_get_param (xine_stream_t *stream, int param) {
switch (param) {
case XINE_PARAM_SPEED:
- ret = stream->xine->clock->speed;
+ ret = _x_get_speed(stream);
+ break;
+
+ case XINE_PARAM_FINE_SPEED:
+ ret = _x_get_fine_speed(stream);
break;
case XINE_PARAM_AV_OFFSET:
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 5c45168db..fa302dfc3 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.158 2004/06/13 21:28:58 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.159 2004/08/02 12:51:21 miguelfreitas Exp $
*
*/
@@ -448,6 +448,12 @@ ao_driver_t *_x_load_audio_output_plugin (xine_t *self, char *id);
void _x_set_speed (xine_stream_t *stream, int speed) ;
+int _x_get_speed (xine_stream_t *stream) ;
+
+void _x_set_fine_speed (xine_stream_t *stream, int speed) ;
+
+int _x_get_fine_speed (xine_stream_t *stream) ;
+
void _x_select_spu_channel (xine_stream_t *stream, int channel) ;
int _x_get_audio_channel (xine_stream_t *stream) ;