2 * gstvaapiimagepool.c - Gst VA image pool
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1
9 * of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
23 * SECTION:gstvaapiimagepool
24 * @short_description: VA image pool
28 #include "gstvaapiimagepool.h"
31 #include "gstvaapidebug.h"
36 GST_VAAPI_TYPE_VIDEO_POOL);
38 #define GST_VAAPI_IMAGE_POOL_GET_PRIVATE(obj) \
39 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
40 GST_VAAPI_TYPE_IMAGE_POOL, \
41 GstVaapiImagePoolPrivate))
43 struct _GstVaapiImagePoolPrivate {
44 GstVaapiImageFormat format;
50 gst_vaapi_image_pool_set_caps(GstVaapiVideoPool *pool, GstCaps *caps)
52 GstVaapiImagePoolPrivate * const priv = GST_VAAPI_IMAGE_POOL(pool)->priv;
53 GstStructure *structure;
56 structure = gst_caps_get_structure(caps, 0);
57 gst_structure_get_int(structure, "width", &width);
58 gst_structure_get_int(structure, "height", &height);
60 priv->format = gst_vaapi_image_format_from_caps(caps);
62 priv->height = height;
66 gst_vaapi_image_pool_alloc_object(
67 GstVaapiVideoPool *pool,
68 GstVaapiDisplay *display
71 GstVaapiImagePoolPrivate * const priv = GST_VAAPI_IMAGE_POOL(pool)->priv;
73 return gst_vaapi_image_new(display,
80 gst_vaapi_image_pool_finalize(GObject *object)
82 G_OBJECT_CLASS(gst_vaapi_image_pool_parent_class)->finalize(object);
86 gst_vaapi_image_pool_class_init(GstVaapiImagePoolClass *klass)
88 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
89 GstVaapiVideoPoolClass * const pool_class = GST_VAAPI_VIDEO_POOL_CLASS(klass);
91 g_type_class_add_private(klass, sizeof(GstVaapiImagePoolPrivate));
93 object_class->finalize = gst_vaapi_image_pool_finalize;
95 pool_class->set_caps = gst_vaapi_image_pool_set_caps;
96 pool_class->alloc_object = gst_vaapi_image_pool_alloc_object;
100 gst_vaapi_image_pool_init(GstVaapiImagePool *pool)
102 GstVaapiImagePoolPrivate *priv = GST_VAAPI_IMAGE_POOL_GET_PRIVATE(pool);
111 * gst_vaapi_image_pool_new:
112 * @display: a #GstVaapiDisplay
115 * Creates a new #GstVaapiVideoPool of #GstVaapiImage with the
116 * specified dimensions in @caps.
118 * Return value: the newly allocated #GstVaapiVideoPool
121 gst_vaapi_image_pool_new(GstVaapiDisplay *display, GstCaps *caps)
123 return g_object_new(GST_VAAPI_TYPE_IMAGE_POOL,