GST_WARNING ("seeking failed %s", gst_flow_get_name (ret));
else {
GstEvent *new_seek;
- base->mode = BASE_MODE_SEEKING;
-
- new_seek = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
- GST_SEEK_TYPE_SET, base->seek_offset, GST_SEEK_TYPE_NONE, -1);
- gst_event_set_seqnum (new_seek, GST_EVENT_SEQNUM (event));
- if (!gst_pad_push_event (base->sinkpad, new_seek))
- ret = GST_FLOW_ERROR;
- else
- base->last_seek_seqnum = GST_EVENT_SEQNUM (event);
+
+ if (GST_CLOCK_TIME_IS_VALID (base->seek_offset)) {
+ base->mode = BASE_MODE_SEEKING;
+ new_seek = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
+ GST_SEEK_TYPE_SET, base->seek_offset, GST_SEEK_TYPE_NONE, -1);
+ gst_event_set_seqnum (new_seek, GST_EVENT_SEQNUM (event));
+ if (!gst_pad_push_event (base->sinkpad, new_seek))
+ ret = GST_FLOW_ERROR;
+ else
+ base->last_seek_seqnum = GST_EVENT_SEQNUM (event);
+ }
base->mode = BASE_MODE_PUSHING;
}
}
/* configure the segment with the seek variables */
GST_DEBUG_OBJECT (demux, "configuring seek");
- start_offset =
- mpegts_packetizer_ts_to_offset (base->packetizer, MAX (0,
- start - SEEK_TIMESTAMP_OFFSET), demux->program->pcr_pid);
+ if (start_type != GST_SEEK_TYPE_NONE) {
+ start_offset =
+ mpegts_packetizer_ts_to_offset (base->packetizer, MAX (0,
+ start - SEEK_TIMESTAMP_OFFSET), demux->program->pcr_pid);
+
+ if (G_UNLIKELY (start_offset == -1)) {
+ GST_WARNING ("Couldn't convert start position to an offset");
+ goto done;
+ }
+ } else {
+ start_offset = GST_CLOCK_TIME_NONE;
+ for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
+ TSDemuxStream *stream = tmp->data;
- if (G_UNLIKELY (start_offset == -1)) {
- GST_WARNING ("Couldn't convert start position to an offset");
+ stream->need_newsegment = TRUE;
+ }
+ gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
+ if (demux->segment_event) {
+ gst_event_unref (demux->segment_event);
+ demux->segment_event = NULL;
+ }
+ demux->rate = rate;
+ res = GST_FLOW_OK;
goto done;
}