GST_OBJECT_LOCK (pad);
if (pad->active) {
- GstFormat format = pad->segment.format;
-
ret =
- gst_segment_to_running_time (&pad->segment, format,
+ gst_segment_to_running_time (&pad->segment, pad->segment.format,
pad->segment.position);
}
GST_OBJECT_UNLOCK (pad);
static void
gst_selector_pad_free_cached_buffers (GstSelectorPad * selpad)
{
- GstSelectorPadCachedBuffer *cached_buffer;
-
if (!selpad->cached_buffers)
return;
GST_DEBUG_OBJECT (selpad, "Freeing cached buffers");
- while ((cached_buffer = g_queue_pop_head (selpad->cached_buffers)))
- gst_selector_pad_free_cached_buffer (cached_buffer);
- g_queue_free (selpad->cached_buffers);
+ g_queue_free_full (selpad->cached_buffers,
+ (GDestroyNotify) gst_selector_pad_free_cached_buffer);
selpad->cached_buffers = NULL;
}
gst_object_unref (prev_active_sinkpad);
GST_INPUT_SELECTOR_LOCK (sel);
- active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
/* only forward if we are dealing with the active sinkpad */
forward = (pad == active_sinkpad);
GST_DEBUG_OBJECT (selpad, "entering wait for buffer %p", buf);
/* If we have no valid timestamp we can't sync this buffer */
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+ if (!GST_BUFFER_PTS_IS_VALID (buf)) {
GST_DEBUG_OBJECT (selpad, "leaving wait for buffer with "
"invalid timestamp");
return FALSE;
return FALSE;
}
- running_time = GST_BUFFER_TIMESTAMP (buf);
+ running_time = GST_BUFFER_PTS (buf);
/* If possible try to get the running time at the end of the buffer */
if (GST_BUFFER_DURATION_IS_VALID (buf))
running_time += GST_BUFFER_DURATION (buf);
cached_buffer = g_queue_peek_nth (selpad->cached_buffers, i);
g_string_append_printf (timestamps, " %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (cached_buffer->buffer)));
+ GST_TIME_ARGS (GST_BUFFER_PTS (cached_buffer->buffer)));
}
str = g_string_free (timestamps, FALSE);
GST_DEBUG_OBJECT (selpad, "%s", str);
GSList *l;
/* If we have no valid timestamp we can't sync this buffer */
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
+ if (!GST_BUFFER_PTS_IS_VALID (buffer)) {
maybe_remove = g_slist_append (maybe_remove, cached_buffer);
queue_position = g_slist_length (maybe_remove);
continue;
/* the buffer is still valid if its duration is valid and the
* timestamp + duration is >= time, or if its duration is invalid
* and the timestamp is >= time */
- running_time = GST_BUFFER_TIMESTAMP (buffer);
+ running_time = GST_BUFFER_PTS (buffer);
/* If possible try to get the running time at the end of the buffer */
if (GST_BUFFER_DURATION_IS_VALID (buffer))
running_time += GST_BUFFER_DURATION (buffer);
GstPad *active_sinkpad;
GstPad *prev_active_sinkpad = NULL;
GstSelectorPad *selpad;
- GstClockTime start_time;
sel = GST_INPUT_SELECTOR (parent);
selpad = GST_SELECTOR_PAD_CAST (pad);
GST_DEBUG_OBJECT (selpad,
"entering chain for buf %p with timestamp %" GST_TIME_FORMAT, buf,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
+ GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
GST_INPUT_SELECTOR_LOCK (sel);
/* wait or check for flushing */
}
/* update the segment on the srcpad */
- start_time = GST_BUFFER_TIMESTAMP (buf);
- if (GST_CLOCK_TIME_IS_VALID (start_time)) {
+ if (GST_BUFFER_PTS_IS_VALID (buf)) {
+ GstClockTime start_time = GST_BUFFER_PTS (buf);
+
GST_LOG_OBJECT (pad, "received start time %" GST_TIME_FORMAT,
GST_TIME_ARGS (start_time));
if (GST_BUFFER_DURATION_IS_VALID (buf))
selpad->events_pending = FALSE;
}
- if (prev_active_sinkpad)
+ if (prev_active_sinkpad) {
gst_object_unref (prev_active_sinkpad);
- prev_active_sinkpad = NULL;
+ prev_active_sinkpad = NULL;
+ }
if (selpad->discont) {
buf = gst_buffer_make_writable (buf);
/* forward */
GST_LOG_OBJECT (pad, "Forwarding buffer %p with timestamp %" GST_TIME_FORMAT,
- buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
+ buf, GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
/* Only make the buffer read-only when necessary */
if (sel->sync_streams && sel->cache_buffers)
selpad->active = TRUE;
active_sinkpad = sel->active_sinkpad;
- if (sel->active_sinkpad == NULL) {
+ if (active_sinkpad == NULL) {
GValue item = G_VALUE_INIT;
GstIterator *iter = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (sel));
GstIteratorResult ires;