| 145 | | |
|---|
| 146 | | #if 0 |
|---|
| 147 | | /***************************************************************************** |
|---|
| 148 | | * input_ClockManageControl: handles the messages from the interface |
|---|
| 149 | | ***************************************************************************** |
|---|
| 150 | | * Returns UNDEF_S if nothing happened, PAUSE_S if the stream was paused |
|---|
| 151 | | *****************************************************************************/ |
|---|
| 152 | | int input_ClockManageControl( input_thread_t * p_input, |
|---|
| 153 | | input_clock_t *cl, mtime_t i_clock ) |
|---|
| 154 | | { |
|---|
| 155 | | #if 0 |
|---|
| 156 | | vlc_value_t val; |
|---|
| 157 | | int i_return_value = UNDEF_S; |
|---|
| 158 | | |
|---|
| 159 | | vlc_mutex_lock( &p_input->p->stream.stream_lock ); |
|---|
| 160 | | |
|---|
| 161 | | if( p_input->p->stream.i_new_status == PAUSE_S ) |
|---|
| 162 | | { |
|---|
| 163 | | int i_old_status; |
|---|
| 164 | | |
|---|
| 165 | | vlc_mutex_lock( &p_input->p->stream.control.control_lock ); |
|---|
| 166 | | i_old_status = p_input->p->stream.control.i_status; |
|---|
| 167 | | p_input->p->stream.control.i_status = PAUSE_S; |
|---|
| 168 | | vlc_mutex_unlock( &p_input->p->stream.control.control_lock ); |
|---|
| 169 | | |
|---|
| 170 | | vlc_cond_wait( &p_input->p->stream.stream_wait, |
|---|
| 171 | | &p_input->p->stream.stream_lock ); |
|---|
| 172 | | ClockNewRef( p_pgrm, i_clock, p_pgrm->last_pts > mdate() ? |
|---|
| 173 | | p_pgrm->last_pts : mdate() ); |
|---|
| 174 | | |
|---|
| 175 | | if( p_input->p->stream.i_new_status == PAUSE_S ) |
|---|
| 176 | | { |
|---|
| 177 | | /* PAUSE_S undoes the pause state: Return to old state. */ |
|---|
| 178 | | vlc_mutex_lock( &p_input->p->stream.control.control_lock ); |
|---|
| 179 | | p_input->p->stream.control.i_status = i_old_status; |
|---|
| 180 | | vlc_mutex_unlock( &p_input->p->stream.control.control_lock ); |
|---|
| 181 | | |
|---|
| 182 | | p_input->p->stream.i_new_status = UNDEF_S; |
|---|
| 183 | | p_input->p->stream.i_new_rate = UNDEF_S; |
|---|
| 184 | | } |
|---|
| 185 | | |
|---|
| 186 | | /* We handle i_new_status != PAUSE_S below... */ |
|---|
| 187 | | |
|---|
| 188 | | i_return_value = PAUSE_S; |
|---|
| 189 | | } |
|---|
| 190 | | |
|---|
| 191 | | if( p_input->p->stream.i_new_status != UNDEF_S ) |
|---|
| 192 | | { |
|---|
| 193 | | vlc_mutex_lock( &p_input->p->stream.control.control_lock ); |
|---|
| 194 | | |
|---|
| 195 | | p_input->p->stream.control.i_status = p_input->stream.i_new_status; |
|---|
| 196 | | |
|---|
| 197 | | ClockNewRef( p_pgrm, i_clock, |
|---|
| 198 | | ClockToSysdate( p_input, p_pgrm, i_clock ) ); |
|---|
| 199 | | |
|---|
| 200 | | if( p_input->p->stream.control.i_status == PLAYING_S ) |
|---|
| 201 | | { |
|---|
| 202 | | p_input->p->stream.control.i_rate = DEFAULT_RATE; |
|---|
| 203 | | p_input->p->stream.control.b_mute = 0; |
|---|
| 204 | | } |
|---|
| 205 | | else |
|---|
| 206 | | { |
|---|
| 207 | | p_input->p->stream.control.i_rate = p_input->stream.i_new_rate; |
|---|
| 208 | | p_input->p->stream.control.b_mute = 1; |
|---|
| 209 | | |
|---|
| 210 | | /* Feed the audio decoders with a NULL packet to avoid |
|---|
| 211 | | * discontinuities. */ |
|---|
| 212 | | input_EscapeAudioDiscontinuity( p_input ); |
|---|
| 213 | | } |
|---|
| 214 | | |
|---|
| 215 | | val.i_int = p_input->p->stream.control.i_rate; |
|---|
| 216 | | var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL ); |
|---|
| 217 | | |
|---|
| 218 | | val.i_int = p_input->p->stream.control.i_status; |
|---|
| 219 | | var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL ); |
|---|
| 220 | | |
|---|
| 221 | | p_input->p->stream.i_new_status = UNDEF_S; |
|---|
| 222 | | p_input->p->stream.i_new_rate = UNDEF_S; |
|---|
| 223 | | |
|---|
| 224 | | vlc_mutex_unlock( &p_input->p->stream.control.control_lock ); |
|---|
| 225 | | } |
|---|
| 226 | | |
|---|
| 227 | | vlc_mutex_unlock( &p_input->p->stream.stream_lock ); |
|---|
| 228 | | |
|---|
| 229 | | return( i_return_value ); |
|---|
| 230 | | #endif |
|---|
| 231 | | return UNDEF_S; |
|---|
| 232 | | } |
|---|
| 233 | | #endif |
|---|