Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor into setup()

So that buffer_alloc an use it as well.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information...
commit bb1e62b077292a7c8cfb84c0a0ace02e18bb8d7c 1 parent 5154ab7
@felipec authored
Showing with 40 additions and 32 deletions.
  1. +40 −32 omapfb.c
View
72 omapfb.c
@@ -154,40 +154,9 @@ static struct page *get_page(struct gst_omapfb_sink *self)
return page;
}
-static GstFlowReturn
-buffer_alloc(GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf)
-{
- struct gst_omapfb_sink *self = (struct gst_omapfb_sink *)base;
- GstBuffer *buffer;
- struct page *page;
-
- if (!self->enabled)
- goto missing;
-
- page = get_page(self);
- if (!page)
- goto missing;
-
- buffer = gst_buffer_new();
- GST_BUFFER_DATA(buffer) = page->buf;
- GST_BUFFER_SIZE(buffer) = size;
- gst_buffer_set_caps(buffer, caps);
-
- *buf = buffer;
-
- if (page == self->old_page)
- ioctl(self->overlay_fd, OMAPFB_WAITFORVSYNC);
-
- return GST_FLOW_OK;
-missing:
- *buf = NULL;
- return GST_FLOW_OK;
-}
-
static gboolean
-setcaps(GstBaseSink *base, GstCaps *caps)
+setup(struct gst_omapfb_sink *self, GstCaps *caps)
{
- struct gst_omapfb_sink *self = (struct gst_omapfb_sink *)base;
GstStructure *structure;
int width, height;
int update_mode;
@@ -291,6 +260,45 @@ setcaps(GstBaseSink *base, GstCaps *caps)
return true;
}
+static GstFlowReturn
+buffer_alloc(GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf)
+{
+ struct gst_omapfb_sink *self = (struct gst_omapfb_sink *)base;
+ GstBuffer *buffer;
+ struct page *page;
+
+ if (!self->enabled)
+ goto missing;
+
+ page = get_page(self);
+ if (!page)
+ goto missing;
+
+ buffer = gst_buffer_new();
+ GST_BUFFER_DATA(buffer) = page->buf;
+ GST_BUFFER_SIZE(buffer) = size;
+ gst_buffer_set_caps(buffer, caps);
+
+ *buf = buffer;
+
+ if (page == self->old_page)
+ ioctl(self->overlay_fd, OMAPFB_WAITFORVSYNC);
+
+ return GST_FLOW_OK;
+missing:
+ *buf = NULL;
+ return GST_FLOW_OK;
+}
+
+static gboolean
+setcaps(GstBaseSink *base, GstCaps *caps)
+{
+ struct gst_omapfb_sink *self = (struct gst_omapfb_sink *)base;
+ if (self->enabled)
+ return true;
+ return setup(self, caps);
+}
+
static gboolean
start(GstBaseSink *base)
{
Please sign in to comment.
Something went wrong with that request. Please try again.