mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
vdpaumpegdec: further work on seeking
This commit is contained in:
parent
d65d4c40f5
commit
702cc4a03f
1 changed files with 27 additions and 34 deletions
|
@ -308,6 +308,9 @@ gst_vdp_mpeg_dec_push_video_buffer (GstVdpMpegDec * mpeg_dec,
|
||||||
mpeg_dec->next_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
|
mpeg_dec->next_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
|
||||||
GST_BUFFER_DURATION (buffer);
|
GST_BUFFER_DURATION (buffer);
|
||||||
|
|
||||||
|
gst_segment_set_last_stop (&mpeg_dec->segment, GST_FORMAT_TIME,
|
||||||
|
GST_BUFFER_TIMESTAMP (buffer));
|
||||||
|
|
||||||
mpeg_dec->accumulated_duration += GST_BUFFER_DURATION (buffer);
|
mpeg_dec->accumulated_duration += GST_BUFFER_DURATION (buffer);
|
||||||
mpeg_dec->accumulated_size += GST_BUFFER_SIZE (buffer);
|
mpeg_dec->accumulated_size += GST_BUFFER_SIZE (buffer);
|
||||||
byterate = gst_util_uint64_scale (mpeg_dec->accumulated_size, GST_SECOND,
|
byterate = gst_util_uint64_scale (mpeg_dec->accumulated_size, GST_SECOND,
|
||||||
|
@ -795,34 +798,26 @@ normal_seek (GstPad * pad, GstEvent * event)
|
||||||
GstFormat format, conv;
|
GstFormat format, conv;
|
||||||
GstSeekFlags flags;
|
GstSeekFlags flags;
|
||||||
GstSeekType cur_type, stop_type;
|
GstSeekType cur_type, stop_type;
|
||||||
gint64 cur, stop;
|
|
||||||
gint64 time_cur, bytes_cur;
|
gint64 time_cur, bytes_cur;
|
||||||
gint64 time_stop, bytes_stop;
|
gint64 time_stop, bytes_stop;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
gboolean update;
|
||||||
GstEvent *peer_event;
|
GstEvent *peer_event;
|
||||||
|
|
||||||
GST_DEBUG ("normal seek");
|
GST_DEBUG ("normal seek");
|
||||||
|
|
||||||
gst_event_parse_seek (event, &rate, &format, &flags,
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
||||||
&cur_type, &cur, &stop_type, &stop);
|
&cur_type, &time_cur, &stop_type, &time_stop);
|
||||||
|
|
||||||
conv = GST_FORMAT_TIME;
|
if (format != GST_FORMAT_TIME)
|
||||||
if (!gst_vdp_mpeg_dec_convert (mpeg_dec, format, cur, conv, &time_cur))
|
return FALSE;
|
||||||
goto convert_failed;
|
|
||||||
if (!gst_vdp_mpeg_dec_convert (mpeg_dec, format, stop, conv, &time_stop))
|
|
||||||
goto convert_failed;
|
|
||||||
|
|
||||||
GST_DEBUG ("seek to time %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
|
gst_segment_set_seek (&mpeg_dec->segment, rate, GST_FORMAT_TIME, flags,
|
||||||
GST_TIME_ARGS (time_cur), GST_TIME_ARGS (time_stop));
|
cur_type, time_cur, stop_type, time_stop, &update);
|
||||||
|
|
||||||
peer_event = gst_event_new_seek (rate, GST_FORMAT_TIME, flags,
|
if (update) {
|
||||||
cur_type, time_cur, stop_type, time_stop);
|
|
||||||
|
|
||||||
/* try seek on time then */
|
/* seek on bytes */
|
||||||
if ((res = gst_pad_push_event (mpeg_dec->sink, peer_event)))
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* else we try to seek on bytes */
|
|
||||||
conv = GST_FORMAT_BYTES;
|
conv = GST_FORMAT_BYTES;
|
||||||
if (!gst_vdp_mpeg_dec_convert (mpeg_dec, GST_FORMAT_TIME, time_cur,
|
if (!gst_vdp_mpeg_dec_convert (mpeg_dec, GST_FORMAT_TIME, time_cur,
|
||||||
conv, &bytes_cur))
|
conv, &bytes_cur))
|
||||||
|
@ -836,12 +831,13 @@ normal_seek (GstPad * pad, GstEvent * event)
|
||||||
gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
||||||
cur_type, bytes_cur, stop_type, bytes_stop);
|
cur_type, bytes_cur, stop_type, bytes_stop);
|
||||||
|
|
||||||
/* do the seek */
|
|
||||||
res = gst_pad_push_event (mpeg_dec->sink, peer_event);
|
|
||||||
|
|
||||||
mpeg_dec->seeking = TRUE;
|
mpeg_dec->seeking = TRUE;
|
||||||
|
|
||||||
done:
|
/* do the seek */
|
||||||
|
res = gst_pad_push_event (mpeg_dec->sink, peer_event);
|
||||||
|
} else
|
||||||
|
res = FALSE;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -914,9 +910,6 @@ gst_vdp_mpeg_dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GST_FORMAT_TIME, &position))
|
GST_FORMAT_TIME, &position))
|
||||||
goto convert_error;
|
goto convert_error;
|
||||||
|
|
||||||
gst_segment_set_newsegment (&mpeg_dec->segment, update, rate,
|
|
||||||
GST_FORMAT_TIME, start, stop, position);
|
|
||||||
|
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
event = gst_event_new_new_segment (update, rate, GST_FORMAT_TIME, start,
|
event = gst_event_new_new_segment (update, rate, GST_FORMAT_TIME, start,
|
||||||
stop, position);
|
stop, position);
|
||||||
|
|
Loading…
Reference in a new issue