poll: add method to get a GPollFD

This commit is contained in:
Wim Taymans 2010-11-03 18:16:08 +01:00
parent 22fa4470e2
commit 35d10af06d
4 changed files with 25 additions and 0 deletions

View file

@ -1898,6 +1898,7 @@ gst_poll_fd_init
gst_poll_free
gst_poll_new
gst_poll_new_timer
gst_poll_get_read_gpollfd
gst_poll_remove_fd
gst_poll_restart
gst_poll_set_controllable

View file

@ -666,6 +666,27 @@ gst_poll_free (GstPoll * set)
g_slice_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

View file

@ -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);

View file

@ -788,6 +788,7 @@ EXPORTS
gst_poll_fd_ignored
gst_poll_fd_init
gst_poll_free
gst_poll_get_read_gpollfd
gst_poll_new
gst_poll_new_timer
gst_poll_read_control