From 965c610028c17530e86d1430971e59c7f76c725a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 25 Feb 2012 15:08:55 +0000 Subject: [PATCH] fdsink: implement SEEKING query We may or may not support seeking. stdout to a terminal doesn't support seeking, for example, but ... ! fdsink > file.foo just might. --- plugins/elements/gstfdsink.c | 13 +++++++++++++ plugins/elements/gstfdsink.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index 6383d2a99c..80e1f301ee 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -222,6 +222,16 @@ gst_fd_sink_query (GstPad * pad, GstQuery * query) gst_query_set_uri (query, fdsink->uri); return TRUE; + case GST_QUERY_SEEKING: + gst_query_parse_seeking (query, &format, NULL, NULL, NULL); + if (format == GST_FORMAT_BYTES || format == GST_FORMAT_DEFAULT) { + gst_query_set_seeking (query, GST_FORMAT_BYTES, fdsink->seekable, 0, + -1); + } else { + gst_query_set_seeking (query, format, FALSE, 0, -1); + } + return TRUE; + default: return gst_pad_query_default (pad, query); } @@ -384,6 +394,9 @@ gst_fd_sink_start (GstBaseSink * basesink) fdsink->bytes_written = 0; fdsink->current_pos = 0; + fdsink->seekable = gst_fd_sink_do_seek (fdsink, 0); + GST_INFO_OBJECT (fdsink, "seeking supported: %d", fdsink->seekable); + return TRUE; /* ERRORS */ diff --git a/plugins/elements/gstfdsink.h b/plugins/elements/gstfdsink.h index 90913b4d5b..59393d0247 100644 --- a/plugins/elements/gstfdsink.h +++ b/plugins/elements/gstfdsink.h @@ -59,6 +59,8 @@ struct _GstFdSink { int fd; guint64 bytes_written; guint64 current_pos; + + gboolean seekable; }; struct _GstFdSinkClass {