1 /*****************************************************************************
2 * input_ext-intf.c: services to the interface
3 *****************************************************************************
4 * Copyright (C) 1998, 1999, 2000 VideoLAN
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
35 #include "stream_control.h"
36 #include "input_ext-dec.h"
37 #include "input_ext-intf.h"
41 /*****************************************************************************
42 * input_Play: comes back to the normal pace of reading
43 *****************************************************************************/
44 void input_Play( input_thread_t * p_input )
46 intf_Msg( "input: playing at normal rate" );
47 vlc_mutex_lock( &p_input->stream.stream_lock );
48 p_input->stream.i_new_status = PLAYING_S;
49 vlc_cond_signal( &p_input->stream.stream_wait );
50 vlc_mutex_unlock( &p_input->stream.stream_lock );
53 /*****************************************************************************
54 * input_Forward: manages fast forward and slow motion
55 *****************************************************************************
56 * Note that if i_rate > DEFAULT_RATE, the pace is slower.
57 *****************************************************************************/
58 void input_Forward( input_thread_t * p_input, int i_rate )
60 if ( i_rate > DEFAULT_RATE )
62 intf_Msg( "input: playing at 1:%i slow motion", i_rate / 1000 );
64 else if( i_rate < DEFAULT_RATE )
66 intf_Msg( "input: playing at %i:1 fast forward", 1000 / i_rate );
70 /* Not very joli, but this is going to disappear soon anyway */
71 input_Play( p_input );
75 vlc_mutex_lock( &p_input->stream.stream_lock );
76 p_input->stream.i_new_status = FORWARD_S;
77 p_input->stream.i_new_rate = i_rate;
78 vlc_cond_signal( &p_input->stream.stream_wait );
79 vlc_mutex_unlock( &p_input->stream.stream_lock );
82 /*****************************************************************************
83 * input_Pause: temporarily stops the reading of the stream
84 *****************************************************************************/
85 void input_Pause( input_thread_t * p_input )
87 intf_Msg( "input: paused" );
88 vlc_mutex_lock( &p_input->stream.stream_lock );
89 p_input->stream.i_new_status = PAUSE_S;
90 vlc_cond_signal( &p_input->stream.stream_wait );
91 vlc_mutex_unlock( &p_input->stream.stream_lock );
94 /*****************************************************************************
95 * input_Seek: changes the stream postion
96 *****************************************************************************/
97 void input_Seek( input_thread_t * p_input, off_t i_position )
99 intf_Msg( "input: seeking position %d/%d", i_position,
100 p_input->stream.i_size );
101 vlc_mutex_lock( &p_input->stream.stream_lock );
102 p_input->stream.i_seek = i_position;
103 vlc_cond_signal( &p_input->stream.stream_wait );
104 vlc_mutex_unlock( &p_input->stream.stream_lock );