mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 06:22:29 +00:00
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.
This commit is contained in:
parent
82a9544385
commit
965c610028
2 changed files with 15 additions and 0 deletions
|
@ -222,6 +222,16 @@ gst_fd_sink_query (GstPad * pad, GstQuery * query)
|
||||||
gst_query_set_uri (query, fdsink->uri);
|
gst_query_set_uri (query, fdsink->uri);
|
||||||
return TRUE;
|
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:
|
default:
|
||||||
return gst_pad_query_default (pad, query);
|
return gst_pad_query_default (pad, query);
|
||||||
}
|
}
|
||||||
|
@ -384,6 +394,9 @@ gst_fd_sink_start (GstBaseSink * basesink)
|
||||||
fdsink->bytes_written = 0;
|
fdsink->bytes_written = 0;
|
||||||
fdsink->current_pos = 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;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
|
@ -59,6 +59,8 @@ struct _GstFdSink {
|
||||||
int fd;
|
int fd;
|
||||||
guint64 bytes_written;
|
guint64 bytes_written;
|
||||||
guint64 current_pos;
|
guint64 current_pos;
|
||||||
|
|
||||||
|
gboolean seekable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstFdSinkClass {
|
struct _GstFdSinkClass {
|
||||||
|
|
Loading…
Reference in a new issue