summaryrefslogtreecommitdiff
path: root/recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch')
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch b/recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch
new file mode 100644
index 0000000..9a6cf47
--- /dev/null
+++ b/recipes-multimedia/gstreamer/gstreamer1.0/0006-poll-Add-check-if-can-read-event-API.patch
@@ -0,0 +1,95 @@
+From 6daed66db8a147783acc117b76afa2e779c8c12c Mon Sep 17 00:00:00 2001
+From: Song Bing <bing.song@nxp.com>
+Date: Thu, 20 Aug 2015 14:57:46 +0800
+Subject: [PATCH 6/7] poll: Add check if can read event API
+
+Need check if can read event of buffer for video decoder based on
+V4L2 driver. Add the API for it.
+
+
+Upstream-Status: Pending [https://bugzilla.gnome.org/show_bug.cgi?id=752962]
+
+Signed-off-by: Song Bing bing.song@nxp.com
+---
+ gst/gstpoll.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ gst/gstpoll.h | 1 +
+ 2 files changed, 53 insertions(+)
+
+diff --git a/gst/gstpoll.c b/gst/gstpoll.c
+index fd672ed..084f6f7 100644
+--- a/gst/gstpoll.c
++++ b/gst/gstpoll.c
+@@ -1242,6 +1242,58 @@ gst_poll_fd_can_read (const GstPoll * set, GstPollFD * fd)
+ return res;
+ }
+
++static gboolean
++gst_poll_fd_can_read_pri_unlocked (const GstPoll * set, GstPollFD * fd)
++{
++ gboolean res = FALSE;
++ gint idx;
++
++ idx = find_index (set->active_fds, fd);
++ if (idx >= 0) {
++#ifndef G_OS_WIN32
++ struct pollfd *pfd = &g_array_index (set->active_fds, struct pollfd, idx);
++
++ res = (pfd->revents & POLLPRI) != 0;
++#else
++ WinsockFd *wfd = &g_array_index (set->active_fds, WinsockFd, idx);
++
++ res = (wfd->events.lNetworkEvents & FD_ACCEPT) != 0;
++#endif
++ } else {
++ GST_WARNING ("%p: couldn't find fd !", set);
++ }
++ GST_DEBUG ("%p: fd (fd:%d, idx:%d) %d", set, fd->fd, fd->idx, res);
++
++ return res;
++}
++
++/**
++ * gst_poll_fd_can_read_pri:
++ * @set: a file descriptor set.
++ * @fd: a file descriptor.
++ *
++ * Check if @fd in @set has data to be read.
++ *
++ * Returns: %TRUE if the descriptor has data to be read.
++ */
++gboolean
++gst_poll_fd_can_read_pri (const GstPoll * set, GstPollFD * fd)
++{
++ gboolean res = FALSE;
++
++ g_return_val_if_fail (set != NULL, FALSE);
++ g_return_val_if_fail (fd != NULL, FALSE);
++ g_return_val_if_fail (fd->fd >= 0, FALSE);
++
++ g_mutex_lock (&((GstPoll *) set)->lock);
++
++ res = gst_poll_fd_can_read_pri_unlocked (set, fd);
++
++ g_mutex_unlock (&((GstPoll *) set)->lock);
++
++ return res;
++}
++
+ /**
+ * gst_poll_fd_can_write:
+ * @set: a file descriptor set.
+diff --git a/gst/gstpoll.h b/gst/gstpoll.h
+index ef6dcea..0513648 100644
+--- a/gst/gstpoll.h
++++ b/gst/gstpoll.h
+@@ -79,6 +79,7 @@ void gst_poll_fd_ignored (GstPoll *set, GstPollFD *fd);
+ gboolean gst_poll_fd_has_closed (const GstPoll *set, GstPollFD *fd);
+ gboolean gst_poll_fd_has_error (const GstPoll *set, GstPollFD *fd);
+ gboolean gst_poll_fd_can_read (const GstPoll *set, GstPollFD *fd);
++gboolean gst_poll_fd_can_read_pri (const GstPoll *set, GstPollFD *fd);
+ gboolean gst_poll_fd_can_write (const GstPoll *set, GstPollFD *fd);
+
+ gint gst_poll_wait (GstPoll *set, GstClockTime timeout);
+--
+1.9.1
+