gstreamer/gst/vaapi/gstvaapivideobuffer.c

111 lines
2.9 KiB
C
Raw Normal View History

2010-03-12 23:48:50 +00:00
/*
* gstvaapivideobuffer.c - Gstreamer/VA video buffer
2010-03-12 23:48:50 +00:00
*
* Copyright (C) 2010-2011 Splitted-Desktop Systems
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
* Copyright (C) 2011-2013 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2010-03-12 23:48:50 +00:00
*
2011-06-14 11:51:41 +00:00
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
2010-03-12 23:48:50 +00:00
*
2011-06-14 11:51:41 +00:00
* This library is distributed in the hope that it will be useful,
2010-03-12 23:48:50 +00:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2011-06-14 11:51:41 +00:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2010-03-12 23:48:50 +00:00
*
2011-06-14 11:51:41 +00:00
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
2010-03-12 23:48:50 +00:00
*/
2010-03-19 16:41:52 +00:00
/**
2010-03-24 08:16:32 +00:00
* SECTION:gstvaapivideobuffer
* @short_description: VA video buffer for GStreamer
2016-10-27 09:06:06 +00:00
*
* This functions creates and decorates a #GstBuffer that is going to
* be used by VA base gstreamer elements.
2010-03-19 16:41:52 +00:00
*/
#include "gstcompat.h"
2010-03-12 23:48:50 +00:00
#include "gstvaapivideobuffer.h"
static inline GstBuffer *
gst_surface_buffer_new (void)
{
return gst_buffer_new ();
}
static GFunc
get_surface_converter (GstVaapiDisplay * display)
{
GFunc func;
switch (gst_vaapi_display_get_class_type (display)) {
default:
func = NULL;
break;
}
return func;
}
static GstBuffer *
new_vbuffer (GstVaapiVideoMeta * meta)
2010-04-29 21:56:10 +00:00
{
GstBuffer *buffer;
g_return_val_if_fail (meta != NULL, NULL);
gst_vaapi_video_meta_set_surface_converter (meta,
get_surface_converter (gst_vaapi_video_meta_get_display (meta)));
buffer = gst_surface_buffer_new ();
if (buffer)
gst_buffer_set_vaapi_video_meta (buffer, meta);
gst_vaapi_video_meta_unref (meta);
return buffer;
2010-03-12 23:48:50 +00:00
}
GstBuffer *
gst_vaapi_video_buffer_new (GstVaapiVideoMeta * meta)
{
g_return_val_if_fail (meta != NULL, NULL);
return new_vbuffer (gst_vaapi_video_meta_ref (meta));
}
GstBuffer *
gst_vaapi_video_buffer_new_empty (void)
{
return gst_surface_buffer_new ();
}
GstBuffer *
gst_vaapi_video_buffer_new_from_pool (GstVaapiVideoPool * pool)
{
return new_vbuffer (gst_vaapi_video_meta_new_from_pool (pool));
}
GstBuffer *
gst_vaapi_video_buffer_new_from_buffer (GstBuffer * buffer)
{
GstVaapiVideoMeta *const meta = gst_buffer_get_vaapi_video_meta (buffer);
return meta ? new_vbuffer (gst_vaapi_video_meta_ref (meta)) : NULL;
}
GstBuffer *
gst_vaapi_video_buffer_new_with_image (GstVaapiImage * image)
{
return new_vbuffer (gst_vaapi_video_meta_new_with_image (image));
}
GstBuffer *
gst_vaapi_video_buffer_new_with_surface_proxy (GstVaapiSurfaceProxy * proxy)
{
return new_vbuffer (gst_vaapi_video_meta_new_with_surface_proxy (proxy));
}