Commit 6f3e4d56 authored by Jean-Paul Saman's avatar Jean-Paul Saman

RTSP rewind and fastforward support (Scale option). Almost entirely rewritten...

RTSP rewind and fastforward support (Scale option). Almost entirely rewritten a patch from K. Staring <Qdk _at_ quickdekay dot net>.
parent c69f698a
...@@ -85,6 +85,7 @@ Jonas Larsen <jonas at vrt.dk> - Danish translation ...@@ -85,6 +85,7 @@ Jonas Larsen <jonas at vrt.dk> - Danish translation
Julien Blache <jb at technologeek.org> - disc ejection code Julien Blache <jb at technologeek.org> - disc ejection code
kty0ne - WinAmp 5 skin for VLC kty0ne - WinAmp 5 skin for VLC
Kevin H. Patterson <kevpatt at khptech dot com> - Theora framesize calculation patch by Kevin H. Patterson (kevpatt at khptech dot com Kevin H. Patterson <kevpatt at khptech dot com> - Theora framesize calculation patch by Kevin H. Patterson (kevpatt at khptech dot com
K. Staring <qdk at quickdekay dot net> - RTSP rewind and fast-forward support
Laurent Jonqueres <laurent_jonqueres at yahoo.fr> - Occitan localization Laurent Jonqueres <laurent_jonqueres at yahoo.fr> - Occitan localization
Laurent Mutricy <laurent.mutricy at ecl2005 dot ec-lyon dot fr> - HTTP interface fixes Laurent Mutricy <laurent.mutricy at ecl2005 dot ec-lyon dot fr> - HTTP interface fixes
Lorena Gomes - Catalan translation Lorena Gomes - Catalan translation
......
...@@ -63,6 +63,8 @@ enum vod_query_e ...@@ -63,6 +63,8 @@ enum vod_query_e
VOD_MEDIA_PAUSE, /* arg1= double * res= */ VOD_MEDIA_PAUSE, /* arg1= double * res= */
VOD_MEDIA_STOP, /* arg1= double res=can fail */ VOD_MEDIA_STOP, /* arg1= double res=can fail */
VOD_MEDIA_SEEK, /* arg1= double * res= */ VOD_MEDIA_SEEK, /* arg1= double * res= */
VOD_MEDIA_REWIND, /* arg1= double * res= */
VOD_MEDIA_FORWARD, /* arg1= double * res= */
}; };
#endif #endif
...@@ -785,7 +785,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl, ...@@ -785,7 +785,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
case HTTPD_MSG_PLAY: case HTTPD_MSG_PLAY:
{ {
char *psz_output, *psz_position, ip[NI_MAXNUMERICHOST]; char *psz_output, ip[NI_MAXNUMERICHOST];
int i, i_port_audio = 0, i_port_video = 0; int i, i_port_audio = 0, i_port_video = 0;
/* for now only multicast so easy */ /* for now only multicast so easy */
...@@ -807,14 +807,14 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl, ...@@ -807,14 +807,14 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
if( p_rtsp->b_playing ) if( p_rtsp->b_playing )
{ {
char *psz_position = httpd_MsgGet( query, "Range" ); char *psz_position = httpd_MsgGet( query, "Range" );
char *psz_scale = httpd_MsgGet( query, "Scale" );
if( psz_position ) psz_position = strstr( psz_position, "npt=" ); if( psz_position ) psz_position = strstr( psz_position, "npt=" );
if( psz_position ) if( psz_position && !psz_scale )
{ {
double f_pos; double f_pos;
char *end; char *end;
msg_Dbg( p_vod, "seeking request: %s", psz_position ); msg_Dbg( p_vod, "seeking request: %s", psz_position );
psz_position += 4; psz_position += 4;
/* FIXME: npt= is not necessarily formatted as a float */ /* FIXME: npt= is not necessarily formatted as a float */
f_pos = us_strtod( psz_position, &end ); f_pos = us_strtod( psz_position, &end );
...@@ -826,6 +826,37 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl, ...@@ -826,6 +826,37 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
} }
break; break;
} }
if( psz_scale )
{
double f_scale = 0.0;
char *end;
f_scale = us_strtod( psz_scale, &end );
if( end > psz_scale )
{
f_scale = (f_scale * 30.0);
if( psz_scale[0] == '-' ) /* rewind */
{
msg_Dbg( p_vod, "rewind request: %s", psz_scale );
vod_MediaControl( p_vod, p_media, psz_session,
VOD_MEDIA_REWIND, f_scale );
}
else if(psz_scale[0] != '1' ) /* fast-forward */
{
msg_Dbg( p_vod, "fastforward request: %s", psz_scale );
vod_MediaControl( p_vod, p_media, psz_session,
VOD_MEDIA_FORWARD, f_scale );
}
if( p_rtsp->b_paused == VLC_TRUE )
{
p_rtsp->b_paused = VLC_FALSE;
vod_MediaControl( p_vod, p_media, psz_session,
VOD_MEDIA_PAUSE, psz_output );
}
}
break;
}
} }
if( p_rtsp->b_playing && p_rtsp->b_paused ) if( p_rtsp->b_playing && p_rtsp->b_paused )
......
...@@ -1276,6 +1276,40 @@ int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, const char *psz_id, ...@@ -1276,6 +1276,40 @@ int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, const char *psz_id,
} }
} }
} }
else if( !strcmp( psz_command, "rewind" ) )
{
float f_pos;
float f_scale;
vlc_value_t val;
if( psz_args )
{
f_scale = i18n_atof( psz_args );
f_pos = var_GetFloat( p_instance->p_input, "position" );
val.f_float = f_pos - (f_scale / 1000.0);
if( val.f_float < 0.0 )
val.f_float = 0.0;
var_Set( p_instance->p_input, "position", val );
return VLC_SUCCESS;
}
}
else if( !strcmp( psz_command, "forward" ) )
{
float f_pos;
float f_scale;
vlc_value_t val;
if( psz_args )
{
f_scale = i18n_atof( psz_args );
f_pos = var_GetFloat( p_instance->p_input, "position" );
val.f_float = f_pos + (f_scale / 1000.0);
if( val.f_float > 1.0 )
val.f_float = 1.0;
var_Set( p_instance->p_input, "position", val );
return VLC_SUCCESS;
}
}
else if( !strcmp( psz_command, "stop" ) ) else if( !strcmp( psz_command, "stop" ) )
{ {
TAB_REMOVE( media->i_instance, media->instance, p_instance ); TAB_REMOVE( media->i_instance, media->instance, p_instance );
...@@ -2353,6 +2387,26 @@ int vlm_MediaVodControl( void *p_private, vod_media_t *p_vod_media, ...@@ -2353,6 +2387,26 @@ int vlm_MediaVodControl( void *p_private, vod_media_t *p_vod_media,
break; break;
} }
case VOD_MEDIA_REWIND:
{
double f_scale = (double)va_arg( args, double );
char psz_scale[50];
lldiv_t div = lldiv( f_scale * 10000000, 10000000 );
sprintf( psz_scale, I64Fd".%07u", div.quot, (unsigned int) div.rem );
i_ret = vlm_MediaControl( vlm, vlm->media[i], psz_id, "rewind", psz_scale );
break;
}
case VOD_MEDIA_FORWARD:
{
double f_scale = (double)va_arg( args, double );
char psz_scale[50];
lldiv_t div = lldiv( f_scale * 10000000, 10000000 );
sprintf( psz_scale, I64Fd".%07u", div.quot, (unsigned int) div.rem );
i_ret = vlm_MediaControl( vlm, vlm->media[i], psz_id, "forward", psz_scale );
break;
}
default: default:
break; break;
} }
...@@ -2362,6 +2416,7 @@ int vlm_MediaVodControl( void *p_private, vod_media_t *p_vod_media, ...@@ -2362,6 +2416,7 @@ int vlm_MediaVodControl( void *p_private, vod_media_t *p_vod_media,
return i_ret; return i_ret;
} }
/***************************************************************************** /*****************************************************************************
* Manage: * Manage:
*****************************************************************************/ *****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment