[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [gst-cvs] gst-plugins-bad: vdpau: GstVdpOutputSrcPad use
From:       satis () kemper ! freedesktop ! org (Carl-Anton Ingmarsson)
Date:       2010-07-30 20:28:19
Message-ID: 20100730202819.CA3AA10057 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: 726290de21c99e75c6c8b826820371068c99d08c
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=726290de21c99e75c6c8b826820371068c99d08c


Author: Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
Date:   Fri Jul 30 14:07:22 2010 +0200

vdpau: GstVdpOutputSrcPad use gst_pad_alloc when outputting video/x-raw-rgb

we implement "acceptcaps" to prevent us from getting a buffer with different
width and height from what we requested.

---

 sys/vdpau/gstvdp/gstvdpoutputsrcpad.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c \
b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c index 078f325..7fc9094 100644
--- a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c
+++ b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c
@@ -53,6 +53,7 @@ struct _GstVdpOutputSrcPad
   gint width, height;
 
   GstVdpBufferPool *bpool;
+  gboolean lock_caps;
 
   /* properties */
   GstVdpDevice *device;
@@ -87,14 +88,20 @@ gst_vdp_output_src_pad_push (GstVdpOutputSrcPad * vdp_pad,
   switch (vdp_pad->output_format) {
     case GST_VDP_OUTPUT_SRC_PAD_FORMAT_RGB:
     {
+      GstFlowReturn ret;
       guint size;
 
       gst_vdp_output_buffer_calculate_size (output_buf, &size);
 
-      /* FIXME: we don't do pad_alloc here since we really want a buffer of
-       * the specified size */
-      outbuf = gst_buffer_new_and_alloc (size);
-      gst_buffer_set_caps (outbuf, GST_PAD_CAPS (vdp_pad));
+      vdp_pad->lock_caps = TRUE;
+      ret = gst_pad_alloc_buffer (pad, 0, size, GST_PAD_CAPS (vdp_pad),
+          &outbuf);
+      vdp_pad->lock_caps = FALSE;
+
+      if (ret != GST_FLOW_OK) {
+        gst_buffer_unref (GST_BUFFER_CAST (output_buf));
+        return ret;
+      }
 
       if (!gst_vdp_output_buffer_download (output_buf, outbuf, error)) {
         gst_buffer_unref (GST_BUFFER_CAST (output_buf));
@@ -211,6 +218,17 @@ gst_vdp_output_src_pad_alloc_buffer (GstVdpOutputSrcPad * \
vdp_pad,  }
 
 static gboolean
+gst_vdp_output_src_pad_acceptcaps (GstPad * pad, GstCaps * caps)
+{
+  GstVdpOutputSrcPad *vdp_pad = GST_VDP_OUTPUT_SRC_PAD (pad);
+
+  if (!vdp_pad->lock_caps)
+    return TRUE;
+
+  return gst_caps_is_equal_fixed (caps, GST_PAD_CAPS (pad));
+}
+
+static gboolean
 gst_vdp_output_src_pad_setcaps (GstPad * pad, GstCaps * caps)
 {
   GstVdpOutputSrcPad *vdp_pad = GST_VDP_OUTPUT_SRC_PAD (pad);
@@ -373,10 +391,15 @@ gst_vdp_output_src_pad_init (GstVdpOutputSrcPad * vdp_pad)
   vdp_pad->bpool = NULL;
   vdp_pad->device = NULL;
 
+  vdp_pad->lock_caps = FALSE;
+
   gst_pad_set_getcaps_function (pad,
       GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_getcaps));
   gst_pad_set_setcaps_function (pad,
       GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_setcaps));
+  gst_pad_set_acceptcaps_function (pad,
+      GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_acceptcaps));
+
   gst_pad_set_activatepush_function (pad,
       GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_activate_push));
 }


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic