{
GstFormat format;
gint64 duration;
+ gdouble rate;
+ res =
+ GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
+ query);
+ if (!res)
+ break;
+
+ GST_OBJECT_LOCK (videorate);
+ rate = videorate->rate;
+ GST_OBJECT_UNLOCK (videorate);
+
+ if (rate == 1.0)
+ break;
gst_query_parse_duration (query, &format, &duration);
}
GST_LOG_OBJECT (videorate, "upstream duration: %" G_GINT64_FORMAT,
duration);
+ /* Shouldn't this be a multiplication if the direction is downstream? */
if (GST_CLOCK_TIME_IS_VALID (duration)) {
- duration = (gint64) (duration / videorate->rate);
+ duration = (gint64) (duration / rate);
}
GST_LOG_OBJECT (videorate, "our duration: %" G_GINT64_FORMAT, duration);
gst_query_set_duration (query, format, duration);
- res = TRUE;
break;
}
case GST_QUERY_POSITION:
{
GstFormat dst_format;
gint64 dst_value;
+ gdouble rate;
+
+ GST_OBJECT_LOCK (videorate);
+ rate = videorate->rate;
+ GST_OBJECT_UNLOCK (videorate);
- gst_query_parse_position (query, &dst_format, &dst_value);
+ gst_query_parse_position (query, &dst_format, NULL);
if (dst_format != GST_FORMAT_TIME) {
GST_DEBUG_OBJECT (videorate, "not TIME format");
break;
}
+ /* Shouldn't this be a multiplication if the direction is downstream? */
dst_value =
(gint64) (gst_segment_to_stream_time (&videorate->segment,
- GST_FORMAT_TIME, videorate->last_ts / videorate->rate));
+ GST_FORMAT_TIME, videorate->last_ts / rate));
GST_LOG_OBJECT (videorate, "our position: %" GST_TIME_FORMAT,
GST_TIME_ARGS (dst_value));
gst_query_set_position (query, dst_format, dst_value);
if (GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
gst_query_set_duration (query, GST_FORMAT_TIME, *duration);
+ return GST_PAD_PROBE_HANDLED;
}
return GST_PAD_PROBE_OK;
}
"could not set to playing");
probe_sink =
gst_pad_add_probe (mysrcpad,
- GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_PUSH,
+ GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
(GstPadProbeCallback) listen_sink_query_duration, &duration, NULL);
query = gst_query_new_duration (GST_FORMAT_TIME);
duration = GST_CLOCK_TIME_NONE;
- gst_pad_peer_query (mysrcpad, query);
+ gst_pad_peer_query (mysinkpad, query);
gst_query_parse_duration (query, NULL, &duration);
fail_unless_equals_uint64 (duration, GST_CLOCK_TIME_NONE);
/* Setting rate to 2.0 */
g_object_set (videorate, "rate", 2.0, NULL);
- gst_pad_peer_query (mysrcpad, query);
+ gst_pad_peer_query (mysinkpad, query);
gst_query_parse_duration (query, NULL, &duration);
fail_unless_equals_uint64 (duration, 0.5 * GST_SECOND);