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_SetRate: change the reading pace
43 *****************************************************************************/
44 void input_SetRate( input_thread_t * p_input, int i_mode )
46 vlc_mutex_lock( &p_input->stream.stream_lock );
51 p_input->stream.i_new_status = PLAYING_S;
52 intf_Msg( "input: playing at normal rate" );
55 case INPUT_RATE_PAUSE:
56 /* XXX: we don't need to check i_status, because input_clock.c
58 p_input->stream.i_new_status = PAUSE_S;
59 intf_Msg( "input: toggling pause" );
62 case INPUT_RATE_FASTER:
63 /* If we are already going too fast, go back to default rate */
64 if( p_input->stream.control.i_rate * 8 <= DEFAULT_RATE )
66 p_input->stream.i_new_status = PLAYING_S;
67 intf_Msg( "input: playing at normal rate" );
71 p_input->stream.i_new_status = FORWARD_S;
73 if( p_input->stream.control.i_rate < DEFAULT_RATE
74 && p_input->stream.control.i_status == FORWARD_S )
76 p_input->stream.i_new_rate =
77 p_input->stream.control.i_rate / 2;
81 p_input->stream.i_new_rate = DEFAULT_RATE / 2;
83 intf_Msg( "input: playing at %i:1 fast forward",
84 DEFAULT_RATE / p_input->stream.i_new_rate );
88 case INPUT_RATE_SLOWER:
89 /* If we are already going too slow, go back to default rate */
90 if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
92 p_input->stream.i_new_status = PLAYING_S;
93 intf_Msg( "input: playing at normal rate" );
97 p_input->stream.i_new_status = FORWARD_S;
99 if( p_input->stream.control.i_rate > DEFAULT_RATE
100 && p_input->stream.control.i_status == FORWARD_S )
102 p_input->stream.i_new_rate =
103 p_input->stream.control.i_rate * 2;
107 p_input->stream.i_new_rate = DEFAULT_RATE * 2;
109 intf_Msg( "input: playing at 1:%i slow motion",
110 p_input->stream.i_new_rate / DEFAULT_RATE );
117 vlc_cond_signal( &p_input->stream.stream_wait );
118 vlc_mutex_unlock( &p_input->stream.stream_lock );
121 /*****************************************************************************
122 * input_Seek: changes the stream postion
123 *****************************************************************************/
124 void input_Seek( input_thread_t * p_input, off_t i_position )
126 vlc_mutex_lock( &p_input->stream.stream_lock );
127 p_input->stream.i_seek = i_position;
129 intf_Msg( "input: seeking position %lld/%lld", i_position,
130 p_input->stream.i_size );
132 vlc_cond_signal( &p_input->stream.stream_wait );
133 vlc_mutex_unlock( &p_input->stream.stream_lock );