mirror of https://code.videolan.org/videolan/vlc
* src/input/input_ext-intf.c : added an input_SetRate function; it is
quite more convenient than, e.g, calling input_SetStatus( STATUS_FASTER ) two times if you want to switch from 1:1 to 4:1 from the interface. Old functions still work. * modules/gui/beos/VlcWrapper.cpp : use it
This commit is contained in:
parent
ba8a03345c
commit
37d2304ff9
|
@ -4,7 +4,7 @@
|
|||
* control the pace of reading.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999, 2000 VideoLAN
|
||||
* $Id: input_ext-intf.h,v 1.90 2003/05/17 22:00:00 gbazin Exp $
|
||||
* $Id: input_ext-intf.h,v 1.91 2003/05/31 12:24:39 titer Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
|
@ -385,6 +385,9 @@ void input_DestroyThread ( input_thread_t * );
|
|||
#define input_SetStatus(a,b) __input_SetStatus(VLC_OBJECT(a),b)
|
||||
VLC_EXPORT( void, __input_SetStatus, ( vlc_object_t *, int ) );
|
||||
|
||||
#define input_SetRate(a,b) __input_SetRate(VLC_OBJECT(a),b)
|
||||
VLC_EXPORT( void, __input_SetRate, ( vlc_object_t *, int ) );
|
||||
|
||||
#define input_Seek(a,b,c) __input_Seek(VLC_OBJECT(a),b,c)
|
||||
VLC_EXPORT( void, __input_Seek, ( vlc_object_t *, off_t, int ) );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001 VideoLAN
|
||||
* $Id: VlcWrapper.cpp,v 1.32 2003/05/30 18:43:31 titer Exp $
|
||||
* $Id: VlcWrapper.cpp,v 1.33 2003/05/31 12:24:39 titer Exp $
|
||||
*
|
||||
* Authors: Florian G. Pflug <fgp@phlo.org>
|
||||
* Jon Lech Johansen <jon-vl@nanocrew.net>
|
||||
|
@ -114,47 +114,7 @@ void VlcWrapper::InputSetRate( int rate )
|
|||
if( !p_input )
|
||||
return;
|
||||
|
||||
int times = 0;
|
||||
int oldrate = InputRate();
|
||||
switch( ( rate > oldrate ) ? ( rate / oldrate ) : ( oldrate / rate ) )
|
||||
{
|
||||
case 64:
|
||||
times = 6;
|
||||
break;
|
||||
case 32:
|
||||
times = 5;
|
||||
break;
|
||||
case 16:
|
||||
times = 4;
|
||||
break;
|
||||
case 8:
|
||||
times = 3;
|
||||
break;
|
||||
case 4:
|
||||
times = 2;
|
||||
break;
|
||||
case 2:
|
||||
times = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
int newrate = oldrate;
|
||||
for( int i = 0; i < times; i++ )
|
||||
{
|
||||
if( rate > oldrate )
|
||||
{
|
||||
input_SetStatus( p_input, INPUT_STATUS_SLOWER );
|
||||
newrate *= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_SetStatus( p_input, INPUT_STATUS_FASTER );
|
||||
newrate /= 2;
|
||||
}
|
||||
/* Wait it's actually done */
|
||||
while( InputRate() != newrate )
|
||||
msleep( 10000 );
|
||||
}
|
||||
input_SetRate( p_input, rate );
|
||||
}
|
||||
|
||||
BList * VlcWrapper::GetChannels( int i_cat )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* input_ext-intf.c: services to the interface
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2001 VideoLAN
|
||||
* $Id: input_ext-intf.c,v 1.49 2003/05/04 22:42:17 gbazin Exp $
|
||||
* $Id: input_ext-intf.c,v 1.50 2003/05/31 12:24:39 titer Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
|
@ -71,7 +71,6 @@ void __input_SetStatus( vlc_object_t * p_this, int i_mode )
|
|||
break;
|
||||
|
||||
case INPUT_STATUS_FASTER:
|
||||
/* If we are already going too fast, go back to default rate */
|
||||
if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE )
|
||||
{
|
||||
msg_Dbg( p_input, "can not play any faster" );
|
||||
|
@ -101,7 +100,6 @@ void __input_SetStatus( vlc_object_t * p_this, int i_mode )
|
|||
break;
|
||||
|
||||
case INPUT_STATUS_SLOWER:
|
||||
/* If we are already going too slow, go back to default rate */
|
||||
if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
|
||||
{
|
||||
msg_Dbg( p_input, "can not play any slower" );
|
||||
|
@ -140,6 +138,58 @@ void __input_SetStatus( vlc_object_t * p_this, int i_mode )
|
|||
vlc_object_release( p_input );
|
||||
}
|
||||
|
||||
void __input_SetRate( vlc_object_t * p_this, int i_rate )
|
||||
{
|
||||
input_thread_t *p_input;
|
||||
|
||||
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
|
||||
|
||||
if( p_input == NULL )
|
||||
{
|
||||
msg_Err( p_this, "no input found" );
|
||||
return;
|
||||
}
|
||||
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
|
||||
if( i_rate * 8 < DEFAULT_RATE )
|
||||
{
|
||||
msg_Dbg( p_input, "can not play faster than 8x" );
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
return;
|
||||
}
|
||||
if( i_rate > DEFAULT_RATE * 8 )
|
||||
{
|
||||
msg_Dbg( p_input, "can not play slower than 1/8x" );
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
return;
|
||||
}
|
||||
|
||||
p_input->stream.i_new_status = FORWARD_S;
|
||||
p_input->stream.i_new_rate = i_rate;
|
||||
|
||||
if ( p_input->stream.i_new_rate < DEFAULT_RATE )
|
||||
{
|
||||
msg_Dbg( p_input, "playing at %i:1 fast forward",
|
||||
DEFAULT_RATE / p_input->stream.i_new_rate );
|
||||
}
|
||||
else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
|
||||
{
|
||||
msg_Dbg( p_input, "playing at 1:%i slow motion",
|
||||
p_input->stream.i_new_rate / DEFAULT_RATE );
|
||||
}
|
||||
else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
|
||||
{
|
||||
p_input->stream.i_new_status = PLAYING_S;
|
||||
msg_Dbg( p_input, "playing at normal rate" );
|
||||
}
|
||||
|
||||
vlc_cond_signal( &p_input->stream.stream_wait );
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
|
||||
vlc_object_release( p_input );
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* input_Seek: changes the stream postion
|
||||
*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue