From 3ae60c3b9d103ad1548dc783a9ea99bd02cafaa2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 29 Feb 2008 11:00:43 +0000 Subject: [PATCH] Add INIT macro and _init method for initializing the GstPollFD. Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gstpoll.c: (gst_poll_fd_init): * gst/gstpoll.h: Add INIT macro and _init method for initializing the GstPollFD. --- ChangeLog | 7 +++++++ docs/gst/gstreamer-sections.txt | 2 ++ gst/gstpoll.c | 16 ++++++++++++++++ gst/gstpoll.h | 12 ++++++++++++ 4 files changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6ac3645..79f6dd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-02-29 Wim Taymans + + * docs/gst/gstreamer-sections.txt: + * gst/gstpoll.c: (gst_poll_fd_init): + * gst/gstpoll.h: + Add INIT macro and _init method for initializing the GstPollFD. + 2008-02-28 Sebastian Dröge * plugins/elements/gstfdsink.c: (gst_fd_sink_start), diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 0571e3b..0d1c1dc 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -1610,6 +1610,7 @@ gst_rank_get_type GstPoll GstPollFD GstPollMode +GST_POLL_FD_INIT gst_poll_add_fd gst_poll_fd_can_read gst_poll_fd_can_write @@ -1617,6 +1618,7 @@ gst_poll_fd_ctl_read gst_poll_fd_ctl_write gst_poll_fd_has_closed gst_poll_fd_has_error +gst_poll_fd_init gst_poll_free gst_poll_get_mode gst_poll_new diff --git a/gst/gstpoll.c b/gst/gstpoll.c index cf16123..27dd44d 100644 --- a/gst/gstpoll.c +++ b/gst/gstpoll.c @@ -365,6 +365,22 @@ gst_poll_get_mode (const GstPoll * set) return mode; } +/** + * gst_poll_fd_init: + * @fd: a #GstPollFD + * + * Initializes @fd. Alternatively you can initialize it with + * #GST_POLL_FD_INIT. + */ +void +gst_poll_fd_init (GstPollFD * fd) +{ + g_return_if_fail (fd != NULL); + + fd->fd = -1; + fd->idx = -1; +} + static gboolean gst_poll_add_fd_unlocked (GstPoll * set, GstPollFD * fd) { diff --git a/gst/gstpoll.h b/gst/gstpoll.h index 2325181..3a9e135 100644 --- a/gst/gstpoll.h +++ b/gst/gstpoll.h @@ -52,6 +52,16 @@ typedef struct { } GstPollFD; /** + * GST_POLL_FD_INIT: + * + * A #GstPollFD must be initialized with this macro, before it can be + * used. This macro can used be to initialize a variable, but it cannot + * be assigned to a variable. In that case you have to use + * gst_poll_fd_init(). + */ +#define GST_POLL_FD_INIT { -1, -1 } + +/** * GstPollMode: * @GST_POLL_MODE_AUTO: choose method automatically * @GST_POLL_MODE_SELECT: use select() when waiting @@ -75,6 +85,8 @@ void gst_poll_free (GstPoll *set); void gst_poll_set_mode (GstPoll *set, GstPollMode mode); GstPollMode gst_poll_get_mode (const GstPoll *set); +void gst_poll_fd_init (GstPollFD *fd); + gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd); gboolean gst_poll_remove_fd (GstPoll *set, GstPollFD *fd); -- 2.7.4