
---
 ext/dv/gstdvdemux.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/ext/dv/gstdvdemux.c b/ext/dv/gstdvdemux.c
index ecba891..fa8eb84 100644
--- a/ext/dv/gstdvdemux.c
+++ b/ext/dv/gstdvdemux.c
@@ -894,8 +894,6 @@ gst_dvdemux_convert_segment (GstDVDemux * dvdemux, GstSegment * src,
  * Convert the time seek to a bytes seek and send it
  * upstream
  *
- * FIXME, upstream might be able to perform time based
- * seek too.
  *
  * Does not take ownership of the event.
  */
@@ -911,21 +909,28 @@ gst_dvdemux_handle_push_seek (GstDVDemux * dvdemux, GstPad * pad,
   gint64 cur, stop;
   gint64 start_position, end_position;
   GstEvent *newevent;
+  GstQuery *query;
 
   gst_event_parse_seek (event, &rate, &format, &flags,
       &cur_type, &cur, &stop_type, &stop);
 
-  /* we convert the start/stop on the srcpad to the byte format
-   * on the sinkpad and forward the event */
-  res = gst_dvdemux_convert_src_to_sink (dvdemux, pad,
-      format, cur, stop, GST_FORMAT_BYTES, &start_position, &end_position);
-  if (!res)
-    goto done;
-
-  /* now this is the updated seek event on bytes */
-  newevent = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
-      cur_type, start_position, stop_type, end_position);
-
+  /* check if upstream can handle this format for seeking */
+  query = gst_query_new_seeking (format);
+  if (!gst_pad_peer_query (dvdemux->sinkpad, query)) {
+	  /* we convert the start/stop on the srcpad to the byte format
+	   * on the sinkpad and forward the event */
+	  res = gst_dvdemux_convert_src_to_sink (dvdemux, pad,
+		  format, cur, stop, GST_FORMAT_BYTES, &start_position, &end_position);
+	  if (!res)
+		goto done;
+
+	  /* now this is the updated seek event on bytes */
+	  newevent = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
+		  cur_type, start_position, stop_type, end_position);
+  }else{
+	  newevent=event;
+  }
+  gst_query_unref(query);
   res = gst_pad_push_event (dvdemux->sinkpad, newevent);
 
 done:
-- 
1.6.5.1.1367.gcd48

