mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
rtspsrc: improve handling of rate in seeks
This commit is contained in:
parent
e18d5d6ec6
commit
544f8fecf4
2 changed files with 22 additions and 20 deletions
|
@ -2683,7 +2683,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
GstSeekFlags flags;
|
GstSeekFlags flags;
|
||||||
GstSeekType cur_type = GST_SEEK_TYPE_NONE, stop_type;
|
GstSeekType cur_type = GST_SEEK_TYPE_NONE, stop_type;
|
||||||
gint64 cur, stop;
|
gint64 cur, stop;
|
||||||
gboolean flush, skip;
|
gboolean flush, server_side_trickmode;
|
||||||
gboolean update;
|
gboolean update;
|
||||||
gboolean playing;
|
gboolean playing;
|
||||||
GstSegment seeksegment = { 0, };
|
GstSegment seeksegment = { 0, };
|
||||||
|
@ -2695,10 +2695,6 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
gst_event_parse_seek (event, &rate, &format, &flags,
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
||||||
&cur_type, &cur, &stop_type, &stop);
|
&cur_type, &cur, &stop_type, &stop);
|
||||||
|
|
||||||
/* no negative rates yet */
|
|
||||||
if (rate < 0.0)
|
|
||||||
goto negative_rate;
|
|
||||||
|
|
||||||
/* we need TIME format */
|
/* we need TIME format */
|
||||||
if (format != src->segment.format)
|
if (format != src->segment.format)
|
||||||
goto no_format;
|
goto no_format;
|
||||||
|
@ -2716,7 +2712,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
|
|
||||||
/* get flush flag */
|
/* get flush flag */
|
||||||
flush = flags & GST_SEEK_FLAG_FLUSH;
|
flush = flags & GST_SEEK_FLAG_FLUSH;
|
||||||
skip = flags & GST_SEEK_FLAG_SKIP;
|
server_side_trickmode = flags & GST_SEEK_FLAG_TRICKMODE;
|
||||||
|
|
||||||
/* now we need to make sure the streaming thread is stopped. We do this by
|
/* now we need to make sure the streaming thread is stopped. We do this by
|
||||||
* either sending a FLUSH_START event downstream which will cause the
|
* either sending a FLUSH_START event downstream which will cause the
|
||||||
|
@ -2764,7 +2760,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
gst_rtspsrc_get_position (src);
|
gst_rtspsrc_get_position (src);
|
||||||
gst_rtspsrc_pause (src, FALSE);
|
gst_rtspsrc_pause (src, FALSE);
|
||||||
}
|
}
|
||||||
src->skip = skip;
|
src->server_side_trickmode = server_side_trickmode;
|
||||||
|
|
||||||
src->state = GST_RTSP_STATE_SEEKING;
|
src->state = GST_RTSP_STATE_SEEKING;
|
||||||
|
|
||||||
|
@ -2826,11 +2822,6 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
negative_rate:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (src, "negative playback rates are not supported yet.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
no_format:
|
no_format:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (src, "unsupported format given, seek aborted.");
|
GST_DEBUG_OBJECT (src, "unsupported format given, seek aborted.");
|
||||||
|
@ -7665,7 +7656,7 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp,
|
||||||
|
|
||||||
/* reset our state */
|
/* reset our state */
|
||||||
src->need_range = TRUE;
|
src->need_range = TRUE;
|
||||||
src->skip = FALSE;
|
src->server_side_trickmode = FALSE;
|
||||||
|
|
||||||
src->state = GST_RTSP_STATE_READY;
|
src->state = GST_RTSP_STATE_READY;
|
||||||
|
|
||||||
|
@ -8317,13 +8308,24 @@ restart:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (segment->rate != 1.0) {
|
if (segment->rate != 1.0) {
|
||||||
gchar hval[G_ASCII_DTOSTR_BUF_SIZE];
|
gchar scale_val[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
|
gchar speed_val[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
|
|
||||||
g_ascii_dtostr (hval, sizeof (hval), segment->rate);
|
if (src->server_side_trickmode) {
|
||||||
if (src->skip)
|
g_ascii_dtostr (scale_val, sizeof (scale_val), segment->rate);
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SCALE, hval);
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SCALE, scale_val);
|
||||||
else
|
} else if (segment->rate < 0.0) {
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SPEED, hval);
|
g_ascii_dtostr (scale_val, sizeof (scale_val), -1.0);
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SCALE, scale_val);
|
||||||
|
|
||||||
|
if (ABS (segment->rate) != 1.0) {
|
||||||
|
g_ascii_dtostr (speed_val, sizeof (speed_val), ABS (segment->rate));
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SPEED, speed_val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g_ascii_dtostr (speed_val, sizeof (speed_val), segment->rate);
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SPEED, speed_val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seek_style)
|
if (seek_style)
|
||||||
|
|
|
@ -207,7 +207,7 @@ struct _GstRTSPSrc {
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
gboolean running;
|
gboolean running;
|
||||||
gboolean need_range;
|
gboolean need_range;
|
||||||
gboolean skip;
|
gboolean server_side_trickmode;
|
||||||
gint free_channel;
|
gint free_channel;
|
||||||
gboolean need_segment;
|
gboolean need_segment;
|
||||||
GstClockTime base_time;
|
GstClockTime base_time;
|
||||||
|
|
Loading…
Reference in a new issue