+ case DEMUX_CAN_CONTROL_RATE:
+ pb = (bool*)va_arg( args, bool * );
+ pb2 = (bool*)va_arg( args, bool * );
+
+ *pb = (p_sys->rtsp != NULL) &&
+ (p_sys->i_npt_length > 0) &&
+ !var_GetBool( p_demux, "rtsp-kasenna" );
+ *pb2 = false;
+ return VLC_SUCCESS;
+
+ case DEMUX_SET_RATE:
+ {
+ double f_scale, f_old_scale;
+
+ if( !p_sys->rtsp || (p_sys->i_npt_length <= 0) ||
+ var_GetBool( p_demux, "rtsp-kasenna" ) )
+ return VLC_EGENERIC;
+
+ /* According to RFC 2326 p56 chapter 12.35 a RTSP server that
+ * supports Scale should:
+ *
+ * "The server should try to approximate the viewing rate, but may
+ * restrict the range of scale values that it supports. The response
+ * MUST contain the actual scale value chosen by the server."
+ *
+ * Scale = 1 indicates normal play
+ * Scale > 1 indicates fast forward
+ * Scale < 1 && Scale > 0 indicates slow motion
+ * Scale < 0 value indicates rewind
+ */
+
+ pi_int = (int*)va_arg( args, int * );
+ f_scale = (double)INPUT_RATE_DEFAULT / (*pi_int);
+ f_old_scale = p_sys->ms->scale();
+
+ /* Passing -1 for the start and end time will mean liveMedia won't
+ * create a Range: section for the RTSP message. The server should
+ * pick up from the current position */
+ if( !p_sys->rtsp->playMediaSession( *p_sys->ms, -1, -1, f_scale ) )
+ {
+ msg_Err( p_demux, "PLAY with Scale %0.2f failed %s", f_scale,
+ p_sys->env->getResultMsg() );
+ return VLC_EGENERIC;
+ }
+
+ if( p_sys->ms->scale() == f_old_scale )
+ {
+ msg_Err( p_demux, "no scale change using old Scale %0.2f",
+ p_sys->ms->scale() );
+ return VLC_EGENERIC;
+ }
+
+ /* ReSync the stream */
+ p_sys->i_npt_start = 0;
+ p_sys->i_pcr = 0;
+ p_sys->i_npt = 0.0;
+
+ *pi_int = (int)( INPUT_RATE_DEFAULT / p_sys->ms->scale() );
+ msg_Dbg( p_demux, "PLAY with new Scale %0.2f (%d)", p_sys->ms->scale(), (*pi_int) );
+ return VLC_SUCCESS;
+ }
+