summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d61498d)
raw | patch | inline | side by side (parent: d61498d)
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | |
Fri, 27 Feb 2009 12:41:58 +0000 (13:41 +0100) | ||
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | |
Fri, 27 Feb 2009 13:58:21 +0000 (14:58 +0100) |
Since SEEK event handling might perform some conversion
from TIME to BYTES, do not let upstream fool application
into (TIME) seeking not being possible.
from TIME to BYTES, do not let upstream fool application
into (TIME) seeking not being possible.
gst/mpegaudioparse/gstmpegaudioparse.c | patch | blob | history |
index 4f0a38f4313548c9c600b14f740614e58a17610f..dfd4e60681d502b763dc99dcfaf961b65cefdb42 100644 (file)
g_return_val_if_fail (mp3parse != NULL, FALSE);
+ GST_LOG_OBJECT (pad, "%s query", GST_QUERY_TYPE_NAME (query));
+
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
gst_query_parse_position (query, &format, NULL);
res = TRUE;
}
break;
+ case GST_QUERY_SEEKING:
+ gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
+
+ /* does upstream handle ? */
+ if ((peer = gst_pad_get_peer (mp3parse->sinkpad)) != NULL) {
+ res = gst_pad_query (peer, query);
+ gst_object_unref (peer);
+ }
+ /* we may be able to help if in TIME */
+ if (format == GST_FORMAT_TIME) {
+ gboolean seekable;
+
+ gst_query_parse_seeking (query, &format, &seekable, NULL, NULL);
+ /* already OK if upstream takes care */
+ if (res && !seekable) {
+ gint64 pos;
+
+ seekable = TRUE;
+ if (!mp3parse_total_time (mp3parse, &total) || total == -1) {
+ seekable = FALSE;
+ } else if (!mp3parse_time_to_bytepos (mp3parse, 0, &pos)) {
+ seekable = FALSE;
+ } else {
+ GstQuery *q;
+
+ q = gst_query_new_seeking (GST_FORMAT_BYTES);
+ if (!gst_pad_peer_query (mp3parse->sinkpad, q)) {
+ seekable = FALSE;
+ } else {
+ gst_query_parse_seeking (q, &format, &seekable, NULL, NULL);
+ }
+ gst_query_unref (q);
+ }
+ gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, total);
+ res = TRUE;
+ }
+ }
+ break;
default:
res = gst_pad_query_default (pad, query);
break;