summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-11-03 18:16:08 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2010-12-03 15:50:38 +0100
commit35d10af06d2becc900d788ce16ed2da9710e22e6 (patch)
tree5245605756401bda8ef82fdd5780fbecce70588a /gst
parent22fa4470e2497a1b766322497e285ca199709fcc (diff)
poll: add method to get a GPollFD
Diffstat (limited to 'gst')
-rw-r--r--gst/gstpoll.c21
-rw-r--r--gst/gstpoll.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/gst/gstpoll.c b/gst/gstpoll.c
index 6cef398c4f..5ae8aef5e7 100644
--- a/gst/gstpoll.c
+++ b/gst/gstpoll.c
@@ -667,6 +667,27 @@ gst_poll_free (GstPoll * set)
}
/**
+ * gst_poll_get_read_gpollfd:
+ * @set: a #GstPoll
+ * @fd: a #GPollFD
+ *
+ * Get a GPollFD for the reading part of the control socket. This is useful when
+ * integrating with a GSource and GMainLoop.
+ *
+ * Since: 0.10.32
+ */
+void
+gst_poll_get_read_gpollfd (GstPoll * set, GPollFD * fd)
+{
+ g_return_if_fail (set != NULL);
+ g_return_if_fail (fd != NULL);
+
+ fd->fd = set->control_read_fd.fd;
+ fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR;
+ fd->revents = 0;
+}
+
+/**
* gst_poll_fd_init:
* @fd: a #GstPollFD
*
diff --git a/gst/gstpoll.h b/gst/gstpoll.h
index 5503fbe944..741a79bf82 100644
--- a/gst/gstpoll.h
+++ b/gst/gstpoll.h
@@ -67,6 +67,8 @@ GstPoll* gst_poll_new (gboolean controllable);
GstPoll* gst_poll_new_timer (void);
void gst_poll_free (GstPoll *set);
+void gst_poll_get_read_gpollfd (GstPoll *set, GPollFD *fd);
+
void gst_poll_fd_init (GstPollFD *fd);
gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd);