2 * gstvaapipluginbuffer.c - Private GStreamer/VA video buffers
4 * Copyright (C) 2012 Intel Corporation
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
26 #include <gst/vaapi/gstvaapivideobuffer.h>
27 #include <gst/vaapi/gstvaapivideobuffer_priv.h>
29 # include <gst/vaapi/gstvaapivideobuffer_glx.h>
31 #include "gstvaapipluginbuffer.h"
34 get_type(GstVaapiDisplay *display)
38 switch (gst_vaapi_display_get_display_type(display)) {
40 case GST_VAAPI_DISPLAY_TYPE_GLX:
41 type = GST_VAAPI_TYPE_VIDEO_BUFFER_GLX;
45 type = GST_VAAPI_TYPE_VIDEO_BUFFER;
52 gst_vaapi_video_buffer_new(GstVaapiDisplay *display)
54 g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL);
56 return gst_vaapi_video_buffer_typed_new(get_type(display), display);
60 gst_vaapi_video_buffer_new_from_pool(GstVaapiVideoPool *pool)
62 GstVaapiDisplay *display;
64 g_return_val_if_fail(GST_VAAPI_IS_VIDEO_POOL(pool), NULL);
66 display = gst_vaapi_video_pool_get_display(pool);
69 return gst_vaapi_video_buffer_typed_new_from_pool(get_type(display), pool);
73 gst_vaapi_video_buffer_new_from_buffer(GstBuffer *buffer)
75 GstVaapiVideoBuffer *vbuffer;
76 GstVaapiDisplay *display;
78 g_return_val_if_fail(GST_VAAPI_IS_VIDEO_BUFFER(buffer), NULL);
80 vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer);
81 display = gst_vaapi_video_buffer_get_display(vbuffer);
85 return gst_vaapi_video_buffer_typed_new_from_buffer(
86 get_type(display), buffer);
90 gst_vaapi_video_buffer_new_with_image(GstVaapiImage *image)
92 GstVaapiDisplay *display;
94 g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), NULL);
96 display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(image));
100 return gst_vaapi_video_buffer_typed_new_with_image(
101 get_type(display), image);
105 gst_vaapi_video_buffer_new_with_surface(GstVaapiSurface *surface)
107 GstVaapiDisplay *display;
109 g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), NULL);
111 display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface));
115 return gst_vaapi_video_buffer_typed_new_with_surface(
116 get_type(display), surface);
120 gst_vaapi_video_buffer_new_with_surface_proxy(GstVaapiSurfaceProxy *proxy)
122 GstVaapiDisplay *display;
123 GstVaapiSurface *surface;
125 g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), NULL);
127 surface = gst_vaapi_surface_proxy_get_surface(proxy);
131 display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface));
135 return gst_vaapi_video_buffer_typed_new_with_surface_proxy(
136 get_type(display), proxy);