sec += ((hour * 60) + min) * 60;
else
if (sscanf (str, "%f", &sec) != 1)
- sec = 0.;
+ sec = -1;
if (loc != (locale_t)0)
{
uselocale (oldloc);
freelocale (loc);
}
- return sec * CLOCK_FREQ;
+ return sec < 0 ? -1 : sec * CLOCK_FREQ;
}
answer->i_status = 200;
psz_session = httpd_MsgGet( query, "Session" );
+ int64_t start = -1, end = -1;
const char *range = httpd_MsgGet (query, "Range");
- if (range != NULL && strncmp (range, "npt=", 4))
+ if (range != NULL)
{
- answer->i_status = 501;
- break;
- }
+ if (strncmp (range, "npt=", 4))
+ {
+ answer->i_status = 501;
+ break;
+ }
+
+ start = ParseNPT (range + 4);
+ range = strchr(range, '-');
+ if (range != NULL && *(range + 1))
+ end = ParseNPT (range + 1);
+ if (end >= 0 && end < start)
+ {
+ answer->i_status = 457;
+ break;
+ }
+
+ if (vod)
+ {
+ if (vod_check_range(rtsp->vod_media, psz_session,
+ start, end) != VLC_SUCCESS)
+ {
+ answer->i_status = 457;
+ break;
+ }
+ }
+ /* We accept start times of 0 even for broadcast streams
+ * that already started */
+ else if (start > 0 || end >= 0)
+ {
+ answer->i_status = 456;
+ break;
+ }
+ }
vlc_mutex_lock( &rtsp->lock );
ses = RtspClientGet( rtsp, psz_session );
if( ses != NULL )
}
if (vod)
{
- /* TODO: fix that crap, this is barely RTSP */
-
- /* We want to seek before unpausing, but it won't
- * work if the instance is not running yet. */
bool running = (sout_id != NULL);
- if (!running)
- vod_start(rtsp->vod_media, psz_session);
-
- if (range != NULL)
- {
- int64_t time = ParseNPT (range + 4);
- vod_seek(rtsp->vod_media, psz_session, time);
- }
-
- /* This is the thing to do to unpause... */
- if (running)
- vod_start(rtsp->vod_media, psz_session);
+ vod_play(rtsp->vod_media, psz_session, start, end, running);
}
}
vlc_mutex_unlock( &rtsp->lock );