gstpoll.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #ifndef __GST_POLL_H__
  24. #define __GST_POLL_H__
  25. #include <glib.h>
  26. #include <glib-object.h>
  27. #include <gst/gstclock.h>
  28. G_BEGIN_DECLS
  29. /**
  30. * GstPoll:
  31. *
  32. * A set of file/network descriptors.
  33. */
  34. typedef struct _GstPoll GstPoll;
  35. /**
  36. * GstPollFD:
  37. * @fd: a file descriptor
  38. *
  39. * A file descriptor object.
  40. */
  41. typedef struct {
  42. int fd;
  43. /*< private >*/
  44. gint idx;
  45. } GstPollFD;
  46. /**
  47. * GST_POLL_FD_INIT:
  48. *
  49. * A #GstPollFD must be initialized with this macro, before it can be
  50. * used. This macro can used be to initialize a variable, but it cannot
  51. * be assigned to a variable. In that case you have to use
  52. * gst_poll_fd_init().
  53. */
  54. #define GST_POLL_FD_INIT { -1, -1 }
  55. GstPoll* gst_poll_new (gboolean controllable) G_GNUC_MALLOC;
  56. GstPoll* gst_poll_new_timer (void) G_GNUC_MALLOC;
  57. void gst_poll_free (GstPoll *set);
  58. void gst_poll_get_read_gpollfd (GstPoll *set, GPollFD *fd);
  59. void gst_poll_fd_init (GstPollFD *fd);
  60. gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd);
  61. gboolean gst_poll_remove_fd (GstPoll *set, GstPollFD *fd);
  62. gboolean gst_poll_fd_ctl_write (GstPoll *set, GstPollFD *fd, gboolean active);
  63. gboolean gst_poll_fd_ctl_read (GstPoll *set, GstPollFD *fd, gboolean active);
  64. void gst_poll_fd_ignored (GstPoll *set, GstPollFD *fd);
  65. gboolean gst_poll_fd_has_closed (const GstPoll *set, GstPollFD *fd);
  66. gboolean gst_poll_fd_has_error (const GstPoll *set, GstPollFD *fd);
  67. gboolean gst_poll_fd_can_read (const GstPoll *set, GstPollFD *fd);
  68. gboolean gst_poll_fd_can_write (const GstPoll *set, GstPollFD *fd);
  69. gint gst_poll_wait (GstPoll *set, GstClockTime timeout);
  70. gboolean gst_poll_set_controllable (GstPoll *set, gboolean controllable);
  71. void gst_poll_restart (GstPoll *set);
  72. void gst_poll_set_flushing (GstPoll *set, gboolean flushing);
  73. gboolean gst_poll_write_control (GstPoll *set);
  74. gboolean gst_poll_read_control (GstPoll *set);
  75. G_END_DECLS
  76. #endif /* __GST_POLL_H__ */