+2005-10-19 Wim Taymans <wim@fluendo.com>
+
+ reviewed by: <delete if not using a buddy>
+
+ * examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
+ (query_positions_elems), (query_positions_pads), (update_scale),
+ (do_seek), (set_update_scale), (message_received), (main):
+ * ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
+ (gst_ogg_demux_perform_seek), (gst_ogg_demux_find_chains),
+ (gst_ogg_demux_loop):
+ * ext/ogg/gstogmparse.c: (gst_ogm_parse_sink_query):
+ * ext/theora/theoradec.c: (theora_dec_src_query),
+ (theora_dec_sink_event):
+ * ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
+ (vorbis_dec_sink_event), (vorbis_handle_data_packet):
+ * gst/adder/gstadder.c: (gst_adder_query):
+ * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audiotestsrc_src_query):
+ * gst/playback/test3.c: (update_scale):
+ * gst/playback/test5.c: (new_pad), (no_more_pads), (start_finding),
+ (dump_element_stats), (main):
+ * gst/playback/test6.c: (main):
+ * gst/sine/gstsinesrc.c: (gst_sinesrc_src_query):
+ * gst/videotestsrc/gstvideotestsrc.c:
+ (gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
+ (gst_videotestsrc_newsegment):
+
2005-10-19 Tim-Philipp Müller <tim at centricular dot net>
* gst/typefind/gsttypefindfunctions.c: (utf8_type_find),
format = seek_formats[i].format;
- if (gst_element_query_position (element, &format, &position, &total)) {
+ if (gst_element_query_position (element, &format, &position) &&
+ gst_element_query_duration (element, &format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
format = seek_formats[i].format;
- if (gst_pad_query_position (pad, &format, &position, &total)) {
+ if (gst_pad_query_position (pad, &format, &position) &&
+ gst_pad_query_duration (pad, &format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query_position (element, &format, &position, &duration);
+ gst_element_query_position (element, &format, &position);
+ gst_element_query_duration (element, &format, &duration);
}
} else {
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
- gst_pad_query_position (pad, &format, &position, &duration);
+ gst_pad_query_position (pad, &format, &position);
+ gst_pad_query_duration (pad, &format, &duration);
}
}
cur = GST_OGG_PAD (pad);
switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
+ case GST_QUERY_DURATION:
{
GstFormat format;
- gst_query_parse_position (query, &format, NULL, NULL);
+ gst_query_parse_duration (query, &format, NULL);
/* can only get position in time */
if (format != GST_FORMAT_TIME) {
- GST_DEBUG ("only query position on TIME is supported");
+ GST_DEBUG ("only query duration on TIME is supported");
res = FALSE;
goto done;
}
/* can only return the total time position */
- gst_query_set_position (query, GST_FORMAT_TIME, -1, ogg->total_time);
+ gst_query_set_duration (query, GST_FORMAT_TIME, ogg->total_time);
break;
}
case GST_QUERY_CONVERT:
/* find length to read last page, we store this for later use. */
format = GST_FORMAT_BYTES;
- res = gst_pad_query_position (peer, &format, NULL, &ogg->length);
+ res = gst_pad_query_duration (peer, &format, &ogg->length);
gst_object_unref (peer);
if (!res)
goto no_length;
{
gint64 val;
- gst_query_parse_position (query, &format, NULL, NULL);
+ gst_query_parse_position (query, &format, NULL);
if (format != GST_FORMAT_DEFAULT && format != GST_FORMAT_TIME)
return FALSE;
if ((res = gst_ogm_parse_sink_convert (pad,
GST_FORMAT_DEFAULT, ogm->next_granulepos, &format, &val))) {
/* don't know the total length here.. */
- gst_query_set_position (query, format, val, -1);
+ gst_query_set_position (query, format, val);
}
break;
}
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
- gint64 granulepos, total, value;
+ gint64 granulepos, value;
GstFormat my_format, format;
gint64 time;
- /* forward to peer for total */
- if (!(res = gst_pad_query (GST_PAD_PEER (dec->sinkpad), query)))
- goto error;
-
/* we can convert a granule position to everything */
granulepos = dec->granulepos;
GST_LOG_OBJECT (dec,
"query %p: we have current granule: %lld", query, granulepos);
- /* parse total time from peer and format */
- gst_query_parse_position (query, &format, NULL, &total);
-
- GST_LOG_OBJECT (dec,
- "query %p: peer returned total: %lld (format %u)",
- query, total, format);
+ /* parse format */
+ gst_query_parse_position (query, &format, NULL);
/* and convert to the final format in two steps with time as the
* intermediate step */
theora_dec_src_convert (pad, my_format, time, &format, &value)))
goto error;
- gst_query_set_position (query, format, value, total);
+ gst_query_set_position (query, format, value);
GST_LOG_OBJECT (dec,
- "query %p: we return %lld and %lld (format %u)",
- query, value, total, format);
+ "query %p: we return %lld (format %u)", query, value, format);
break;
}
+ case GST_QUERY_DURATION:
+ /* forward to peer for total */
+ if (!(res = gst_pad_query (GST_PAD_PEER (dec->sinkpad), query)))
+ goto error;
+ break;
case GST_QUERY_CONVERT:
{
GstFormat src_fmt, dest_fmt;
case GST_QUERY_POSITION:
{
GstFormat format;
- gint64 value, total;
-
- /* query peer for total length */
- if (!(res = gst_pad_query (GST_PAD_PEER (dec->sinkpad), query)))
- goto error;
+ gint64 value;
granulepos = dec->granulepos;
- gst_query_parse_position (query, &format, NULL, &total);
+ gst_query_parse_position (query, &format, NULL);
/* and convert to the final format */
if (!(res =
value = (value - dec->segment_start) + dec->segment_base;
- gst_query_set_position (query, format, value, total);
+ gst_query_set_position (query, format, value);
GST_LOG_OBJECT (dec,
"query %u: peer returned granulepos: %llu - we return %llu (format %u)",
break;
}
+ case GST_QUERY_DURATION:
+ {
+ /* query peer for total length */
+ if (!(res = gst_pad_query (GST_PAD_PEER (dec->sinkpad), query)))
+ goto error;
+ break;
+ }
case GST_QUERY_CONVERT:
{
GstFormat src_fmt, dest_fmt;
gboolean res = FALSE;
switch (GST_QUERY_TYPE (query)) {
- /* FIXME: what to do about the length? query all pads upstream and
- * pick the longest length? or the shortest length? or what? */
case GST_QUERY_POSITION:
{
GstFormat format;
- gst_query_parse_position (query, &format, NULL, NULL);
-
- if (format == GST_FORMAT_TIME) {
- gst_query_set_position (query, GST_FORMAT_TIME, adder->timestamp,
- GST_CLOCK_TIME_NONE);
- res = TRUE;
- } else if (format == GST_FORMAT_DEFAULT) {
- gst_query_set_position (query, GST_FORMAT_DEFAULT, adder->offset,
- GST_BUFFER_OFFSET_NONE);
- res = TRUE;
+ gst_query_parse_position (query, &format, NULL);
+
+ switch (format) {
+ case GST_FORMAT_TIME:
+ gst_query_set_position (query, GST_FORMAT_TIME, adder->timestamp);
+ res = TRUE;
+ break;
+ case GST_FORMAT_DEFAULT:
+ gst_query_set_position (query, GST_FORMAT_DEFAULT, adder->offset);
+ res = TRUE;
+ break;
+ default:
+ break;
}
-
break;
}
+ /* FIXME: what to do about the length? query all pads upstream and
+ * pick the longest length? or the shortest length? or what? */
+ case GST_QUERY_DURATION:
+ break;
default:
break;
}
GstFormat format;
gint64 current;
- gst_query_parse_position (query, &format, NULL, NULL);
+ gst_query_parse_position (query, &format, NULL);
switch (format) {
case GST_FORMAT_TIME:
break;
}
if (res) {
- gst_query_set_position (query, format, current, -1);
+ gst_query_set_position (query, format, current);
}
break;
}
+ case GST_QUERY_DURATION:
+ {
+ GstFormat format;
+
+ /* unlimited length */
+ gst_query_parse_position (query, &format, NULL);
+ gst_query_set_duration (query, format, -1);
+ break;
+ }
default:
break;
}
gint64 position;
GstFormat format = GST_FORMAT_TIME;
- gst_element_query_position (element, &format, &position, &duration);
+ gst_element_query_position (element, &format, &position);
+ gst_element_query_duration (element, &format, &duration);
g_print ("%" G_GINT64_FORMAT " %" G_GINT64_FORMAT "\n", duration, position);
if (gst_pad_query (pad, query)) {
gint64 duration;
- gst_query_parse_position (query, NULL, NULL, &duration);
+ gst_query_parse_duration (query, NULL, &duration);
g_print (" duration: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (duration));
}
if (gst_pad_query (pad, query)) {
gint64 duration;
- gst_query_parse_position (query, NULL, NULL, &duration);
+ gst_query_parse_duration (query, NULL, &duration);
g_print (" duration: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (duration));
}
GstFormat format;
gint64 current;
- gst_query_parse_position (query, &format, NULL, NULL);
+ gst_query_parse_position (query, &format, NULL);
switch (format) {
case GST_FORMAT_TIME:
break;
}
if (res) {
- gst_query_set_position (query, format, current, -1);
+ gst_query_set_position (query, format, current);
}
break;
}
+ case GST_QUERY_DURATION:
+ {
+ GstFormat format;
+
+ gst_query_parse_position (query, &format, NULL);
+ gst_query_set_position (query, format, -1);
+ break;
+ }
default:
break;
}
format = seek_formats[i].format;
- if (gst_element_query_position (element, &format, &position, &total)) {
+ if (gst_element_query_position (element, &format, &position) &&
+ gst_element_query_duration (element, &format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
format = seek_formats[i].format;
- if (gst_pad_query_position (pad, &format, &position, &total)) {
+ if (gst_pad_query_position (pad, &format, &position) &&
+ gst_pad_query_duration (pad, &format, &total)) {
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
seek_formats[i].name, position, total);
} else {
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query_position (element, &format, &position, &duration);
+ gst_element_query_position (element, &format, &position);
+ gst_element_query_duration (element, &format, &duration);
}
} else {
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
- gst_pad_query_position (pad, &format, &position, &duration);
+ gst_pad_query_position (pad, &format, &position);
+ gst_pad_query_duration (pad, &format, &duration);
}
}