update for bufferpool changes
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 15 Mar 2012 21:10:58 +0000 (22:10 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 15 Mar 2012 21:10:58 +0000 (22:10 +0100)
ext/libvisual/visual.c
ext/theora/gsttheoradec.c
gst-libs/gst/video/gstvideofilter.c
gst-libs/gst/video/gstvideopool.c
gst-libs/gst/video/gstvideopool.h
sys/ximage/ximagepool.c
sys/ximage/ximagesink.c
sys/xvimage/xvimagepool.c
sys/xvimage/xvimagesink.c

index 3cba8f1..2d4bc4e 100644 (file)
@@ -486,7 +486,7 @@ gst_vis_src_negotiate (GstVisual * visual)
 
   /* and configure */
   config = gst_buffer_pool_get_config (pool);
-  gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+  gst_buffer_pool_config_set_params (config, target, size, min, max);
   gst_buffer_pool_set_config (pool, config);
 
   if (visual->pool)
index 9558ea6..89810c0 100644 (file)
@@ -917,7 +917,7 @@ theora_negotiate (GstTheoraDec * dec)
   size = MAX (size, GST_VIDEO_INFO_SIZE (&dec->vinfo));
 
   config = gst_buffer_pool_get_config (pool);
-  gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
+  gst_buffer_pool_config_set_params (config, caps, size, min, max);
   gst_caps_unref (caps);
 
   if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
index d37956c..782fbb0 100644 (file)
@@ -82,11 +82,14 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans,
 
   if (need_pool) {
     GstStructure *structure;
+    static GstAllocationParams params = { 0, 0, 0, 15, };
 
     pool = gst_video_buffer_pool_new ();
 
     structure = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 0, 15);
+    gst_buffer_pool_config_set_params (structure, caps, size, 0, 0);
+    gst_buffer_pool_config_set_allocator (structure, NULL, &params);
+
     if (!gst_buffer_pool_set_config (pool, structure))
       goto config_failed;
   } else
index 2f27a75..c56a2cc 100644 (file)
@@ -138,12 +138,12 @@ gst_video_info_align (GstVideoInfo * info, GstVideoAlignment * align)
 /* bufferpool */
 struct _GstVideoBufferPoolPrivate
 {
-  GstAllocator *allocator;
   GstCaps *caps;
   GstVideoInfo info;
   GstVideoAlignment video_align;
   gboolean add_videometa;
   gboolean need_alignment;
+  GstAllocator *allocator;
   GstAllocationParams params;
 };
 
@@ -172,10 +172,10 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   GstVideoInfo info;
   const GstCaps *caps;
   gint width, height;
-  guint prefix, padding, align;
+  GstAllocator *allocator;
+  GstAllocationParams params;
 
-  if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, &prefix,
-          &padding, &align))
+  if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
     goto wrong_config;
 
   if (caps == NULL)
@@ -185,6 +185,9 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   if (!gst_video_info_from_caps (&info, caps))
     goto wrong_caps;
 
+  if (!gst_buffer_pool_config_get_allocator (config, &allocator, &params))
+    goto wrong_config;
+
   width = info.width;
   height = info.height;
 
@@ -193,10 +196,12 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   if (priv->caps)
     gst_caps_unref (priv->caps);
   priv->caps = gst_caps_copy (caps);
-  gst_allocation_params_init (&priv->params);
-  priv->params.prefix = prefix;
-  priv->params.padding = padding;
-  priv->params.align = align;
+
+  priv->params = params;
+  if (priv->allocator)
+    gst_allocator_unref (priv->allocator);
+  if ((priv->allocator = allocator))
+    gst_allocator_ref (allocator);
 
   /* enable metadata based on config of the pool */
   priv->add_videometa =
@@ -327,54 +332,3 @@ gst_video_buffer_pool_finalize (GObject * object)
 
   G_OBJECT_CLASS (gst_video_buffer_pool_parent_class)->finalize (object);
 }
-
-/**
- * gst_video_buffer_pool_get_allocator:
- * @pool: a #GstVideoBufferPool
- *
- * Get the allocator used by @pool to allocate the video memory.
- *
- * Returns: (transfer full) the allocator used for allocating video memory.
- * gst_allocator_unref() after usage.
- */
-GstAllocator *
-gst_video_buffer_pool_get_allocator (GstVideoBufferPool * pool)
-{
-  GstAllocator *alloc;
-
-  g_return_val_if_fail (GST_IS_VIDEO_BUFFER_POOL (pool), NULL);
-
-  if ((alloc = pool->priv->allocator))
-    gst_allocator_ref (alloc);
-
-  return alloc;
-}
-
-/**
- * gst_video_buffer_pool_set_allocator:
- * @pool: a #GstVideoBufferPool
- * @allocator: (transfer none): a #GstAllocator
- *
- * Set the allocator used to allocate video memory in @pool. The allocator
- * should only be changed by subclasses.
- */
-void
-gst_video_buffer_pool_set_allocator (GstVideoBufferPool * pool,
-    GstAllocator * allocator)
-{
-  GstAllocator *oldalloc;
-  GstVideoBufferPoolPrivate *priv;
-
-  g_return_if_fail (GST_IS_VIDEO_BUFFER_POOL (pool));
-
-  priv = pool->priv;
-
-  if (allocator)
-    gst_allocator_ref (allocator);
-
-  oldalloc = priv->allocator;
-  priv->allocator = allocator;
-
-  if (oldalloc)
-    gst_allocator_unref (oldalloc);
-}
index a573f18..1c057f1 100644 (file)
@@ -100,10 +100,6 @@ GType             gst_video_buffer_pool_get_type      (void);
 
 GstBufferPool *   gst_video_buffer_pool_new           (void);
 
-GstAllocator *    gst_video_buffer_pool_get_allocator (GstVideoBufferPool *pool);
-void              gst_video_buffer_pool_set_allocator (GstVideoBufferPool *pool,
-                                                       GstAllocator *allocator);
-
 G_END_DECLS
 
 #endif /* __GST_VIDEO_POOL_H__ */
index 3830476..46ebe7a 100644 (file)
@@ -483,8 +483,7 @@ ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   GstVideoInfo info;
   const GstCaps *caps;
 
-  if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
-          NULL))
+  if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
     goto wrong_config;
 
   if (caps == NULL)
index a5b3859..6578539 100644 (file)
@@ -1079,6 +1079,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   GstBufferPool *newpool, *oldpool;
   const GValue *par;
   gint size;
+  static GstAllocationParams params = { 0, 0, 0, 15, };
 
   ximagesink = GST_XIMAGESINK (bsink);
 
@@ -1148,7 +1149,8 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   newpool = gst_ximage_buffer_pool_new (ximagesink);
 
   structure = gst_buffer_pool_get_config (newpool);
-  gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
+  gst_buffer_pool_config_set_params (structure, caps, size, 2, 0);
+  gst_buffer_pool_config_set_allocator (structure, NULL, &params);
   if (!gst_buffer_pool_set_config (newpool, structure))
     goto config_failed;
 
@@ -1442,8 +1444,7 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
 
     /* we had a pool, check caps */
     config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
-        NULL);
+    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
 
     GST_DEBUG_OBJECT (ximagesink,
         "we had a pool with caps %" GST_PTR_FORMAT, pcaps);
@@ -1467,7 +1468,7 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
     size = info.size;
 
     config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
+    gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
     if (!gst_buffer_pool_set_config (pool, config))
       goto config_failed;
   }
index 08ce654..af8087a 100644 (file)
@@ -519,8 +519,7 @@ xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   GstVideoInfo info;
   const GstCaps *caps;
 
-  if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
-          NULL))
+  if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
     goto wrong_config;
 
   if (caps == NULL)
index ef5cf86..08b6a2a 100644 (file)
@@ -1548,6 +1548,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   gint display_par_n, display_par_d;    /* display's PAR */
   guint num, den;
   gint size;
+  static GstAllocationParams params = { 0, 0, 0, 15, };
 
   xvimagesink = GST_XVIMAGESINK (bsink);
 
@@ -1656,7 +1657,8 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   newpool = gst_xvimage_buffer_pool_new (xvimagesink);
 
   structure = gst_buffer_pool_get_config (newpool);
-  gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
+  gst_buffer_pool_config_set_params (structure, caps, size, 2, 0);
+  gst_buffer_pool_config_set_allocator (structure, NULL, &params);
   if (!gst_buffer_pool_set_config (newpool, structure))
     goto config_failed;
 
@@ -1957,8 +1959,7 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
     /* we had a pool, check caps */
     GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
     config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
-        NULL);
+    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
 
     if (!gst_caps_is_equal (caps, pcaps)) {
       GST_DEBUG_OBJECT (xvimagesink, "pool has different caps");
@@ -1981,7 +1982,7 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
     size = info.size;
 
     config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
+    gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
     if (!gst_buffer_pool_set_config (pool, config))
       goto config_failed;
   }