diff options
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/audio_out.c | 4 | ||||
-rw-r--r-- | src/xine-engine/metronom.c | 26 | ||||
-rw-r--r-- | src/xine-engine/metronom.h | 6 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 54 | ||||
-rw-r--r-- | src/xine-engine/xine_interface.c | 14 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 8 |
6 files changed, 82 insertions, 30 deletions
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) ; |