2 * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) 2004 Wim Taymans <wim.taymans@gmail.com>
4 * Copyright (C) 2007 Peter Kjellerstedt <pkj@axis.com>
6 * gstpoll.h: File descriptor set
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_POLL_H__
25 #define __GST_POLL_H__
28 #include <glib-object.h>
30 #include <gst/gstclock.h>
37 * A set of file descriptors.
39 typedef struct _GstPoll GstPoll;
43 * @fd: a file descriptor
45 * A file descriptor object.
57 * A #GstPollFD must be initialized with this macro, before it can be
58 * used. This macro can used be to initialize a variable, but it cannot
59 * be assigned to a variable. In that case you have to use
64 #define GST_POLL_FD_INIT { -1, -1 }
68 * @GST_POLL_MODE_AUTO: choose method automatically
69 * @GST_POLL_MODE_SELECT: use select() when waiting
70 * @GST_POLL_MODE_PSELECT: use pselect() when waiting
71 * @GST_POLL_MODE_POLL: use poll() when waiting
72 * @GST_POLL_MODE_PPOLL: use ppoll() when waiting
74 * Which method to use when waiting for a set of file descriptors.
79 GST_POLL_MODE_PSELECT,
84 GstPoll* gst_poll_new (GstPollMode mode, gboolean controllable);
85 void gst_poll_free (GstPoll *set);
87 void gst_poll_set_mode (GstPoll *set, GstPollMode mode);
88 GstPollMode gst_poll_get_mode (const GstPoll *set);
90 void gst_poll_fd_init (GstPollFD *fd);
92 gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd);
93 gboolean gst_poll_remove_fd (GstPoll *set, GstPollFD *fd);
95 gboolean gst_poll_fd_ctl_write (GstPoll *set, GstPollFD *fd, gboolean active);
96 gboolean gst_poll_fd_ctl_read (GstPoll *set, GstPollFD *fd, gboolean active);
98 gboolean gst_poll_fd_has_closed (const GstPoll *set, GstPollFD *fd);
99 gboolean gst_poll_fd_has_error (const GstPoll *set, GstPollFD *fd);
100 gboolean gst_poll_fd_can_read (const GstPoll *set, GstPollFD *fd);
101 gboolean gst_poll_fd_can_write (const GstPoll *set, GstPollFD *fd);
103 gint gst_poll_wait (GstPoll *set, GstClockTime timeout);
105 gboolean gst_poll_set_controllable (GstPoll *set, gboolean controllable);
106 void gst_poll_restart (GstPoll *set);
107 void gst_poll_set_flushing (GstPoll *set, gboolean flushing);
111 #endif /* __GST_POLL_H__ */