| 1 | /* GStreamer | 
| 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> | 
| 5 |  * | 
| 6 |  * gstpoll.h: File descriptor set | 
| 7 |  * | 
| 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. | 
| 12 |  * | 
| 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. | 
| 17 |  * | 
| 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., 51 Franklin St, Fifth Floor, | 
| 21 |  * Boston, MA 02110-1301, USA. | 
| 22 |  */ | 
| 23 |  | 
| 24 | #ifndef __GST_POLL_H__ | 
| 25 | #define __GST_POLL_H__ | 
| 26 |  | 
| 27 | #include <glib.h> | 
| 28 | #include <glib-object.h> | 
| 29 |  | 
| 30 | #include <gst/gstclock.h> | 
| 31 |  | 
| 32 | G_BEGIN_DECLS | 
| 33 |  | 
| 34 | /** | 
| 35 |  * GstPoll: | 
| 36 |  * | 
| 37 |  * A set of file/network descriptors. | 
| 38 |  */ | 
| 39 | typedef struct _GstPoll GstPoll; | 
| 40 |  | 
| 41 | /** | 
| 42 |  * GstPollFD: | 
| 43 |  * @fd: a file descriptor | 
| 44 |  * | 
| 45 |  * A file descriptor object. | 
| 46 |  */ | 
| 47 | typedef struct { | 
| 48 |   int fd; | 
| 49 |  | 
| 50 |   /*< private >*/ | 
| 51 |   gint idx; | 
| 52 | } GstPollFD; | 
| 53 |  | 
| 54 | /** | 
| 55 |  * GST_POLL_FD_INIT: | 
| 56 |  * | 
| 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 | 
| 60 |  * gst_poll_fd_init(). | 
| 61 |  */ | 
| 62 | #define GST_POLL_FD_INIT  { -1, -1 } | 
| 63 |  | 
| 64 | GST_API | 
| 65 | GstPoll*        gst_poll_new              (gboolean controllable) G_GNUC_MALLOC; | 
| 66 |  | 
| 67 | GST_API | 
| 68 | GstPoll*        gst_poll_new_timer        (void) G_GNUC_MALLOC; | 
| 69 |  | 
| 70 | GST_API | 
| 71 | void            gst_poll_free             (GstPoll *set); | 
| 72 |  | 
| 73 | GST_API | 
| 74 | void            gst_poll_get_read_gpollfd (GstPoll *set, GPollFD *fd); | 
| 75 |  | 
| 76 | GST_API | 
| 77 | void            gst_poll_fd_init          (GstPollFD *fd); | 
| 78 |  | 
| 79 | GST_API | 
| 80 | gboolean        gst_poll_add_fd           (GstPoll *set, GstPollFD *fd); | 
| 81 |  | 
| 82 | GST_API | 
| 83 | gboolean        gst_poll_remove_fd        (GstPoll *set, GstPollFD *fd); | 
| 84 |  | 
| 85 | GST_API | 
| 86 | gboolean        gst_poll_fd_ctl_write     (GstPoll *set, GstPollFD *fd, gboolean active); | 
| 87 |  | 
| 88 | GST_API | 
| 89 | gboolean        gst_poll_fd_ctl_read      (GstPoll *set, GstPollFD *fd, gboolean active); | 
| 90 |  | 
| 91 | GST_API | 
| 92 | gboolean        gst_poll_fd_ctl_pri       (GstPoll *set, GstPollFD *fd, gboolean active); | 
| 93 |  | 
| 94 | GST_API | 
| 95 | void            gst_poll_fd_ignored       (GstPoll *set, GstPollFD *fd); | 
| 96 |  | 
| 97 | GST_API | 
| 98 | gboolean        gst_poll_fd_has_closed    (const GstPoll *set, GstPollFD *fd); | 
| 99 |  | 
| 100 | GST_API | 
| 101 | gboolean        gst_poll_fd_has_error     (const GstPoll *set, GstPollFD *fd); | 
| 102 |  | 
| 103 | GST_API | 
| 104 | gboolean        gst_poll_fd_can_read      (const GstPoll *set, GstPollFD *fd); | 
| 105 |  | 
| 106 | GST_API | 
| 107 | gboolean        gst_poll_fd_can_write     (const GstPoll *set, GstPollFD *fd); | 
| 108 |  | 
| 109 | GST_API | 
| 110 | gboolean        gst_poll_fd_has_pri       (const GstPoll *set, GstPollFD *fd); | 
| 111 |  | 
| 112 | GST_API | 
| 113 | gint            gst_poll_wait             (GstPoll *set, GstClockTime timeout); | 
| 114 |  | 
| 115 | GST_API | 
| 116 | gboolean        gst_poll_set_controllable (GstPoll *set, gboolean controllable); | 
| 117 |  | 
| 118 | GST_API | 
| 119 | void            gst_poll_restart          (GstPoll *set); | 
| 120 |  | 
| 121 | GST_API | 
| 122 | void            gst_poll_set_flushing     (GstPoll *set, gboolean flushing); | 
| 123 |  | 
| 124 | GST_API | 
| 125 | gboolean        gst_poll_write_control    (GstPoll *set); | 
| 126 |  | 
| 127 | GST_API | 
| 128 | gboolean        gst_poll_read_control     (GstPoll *set) G_GNUC_WARN_UNUSED_RESULT; | 
| 129 |  | 
| 130 | G_END_DECLS | 
| 131 |  | 
| 132 | #endif /* __GST_POLL_H__ */ | 
| 133 |  |