2 * gstvaapipluginutil.h - VA-API plugins private helper
4 * Copyright (C) 2011-2014 Intel Corporation
5 * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
6 * Copyright (C) 2011 Collabora
7 * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA
25 #ifndef GST_VAAPI_PLUGIN_UTIL_H
26 #define GST_VAAPI_PLUGIN_UTIL_H
28 #include <gst/vaapi/gstvaapidisplay.h>
29 #include <gst/vaapi/gstvaapisurface.h>
30 #include "gstvaapivideomemory.h"
34 gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type);
38 gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display);
42 gst_vaapi_append_surface_caps (GstCaps * out_caps, GstCaps * in_caps);
46 gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer);
48 #ifndef G_PRIMITIVE_SWAP
49 #define G_PRIMITIVE_SWAP(type, a, b) do { \
50 const type t = a; a = b; b = t; \
54 /* Helpers for GValue construction for video formats */
57 gst_vaapi_value_set_format (GValue * value, GstVideoFormat format);
61 gst_vaapi_value_set_format_list (GValue * value, GArray * formats);
63 /* Helpers to build video caps */
66 GST_VAAPI_CAPS_FEATURE_NOT_NEGOTIATED,
67 GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY,
68 GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META,
69 GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE,
70 } GstVaapiCapsFeature;
74 gst_vaapi_video_format_new_template_caps (GstVideoFormat format);
78 gst_vaapi_video_format_new_template_caps_from_list (GArray * formats);
82 gst_vaapi_video_format_new_template_caps_with_features (GstVideoFormat format,
83 const gchar * features_string);
87 gst_vaapi_find_preferred_caps_feature (GstPad * pad, GstVideoFormat format,
88 GstVideoFormat * out_format_ptr);
92 gst_vaapi_caps_feature_to_string (GstVaapiCapsFeature feature);
94 /* Helpers to handle interlaced contents */
95 # define GST_CAPS_INTERLACED_MODES \
96 "interlace-mode = (string){ progressive, interleaved, mixed }"
97 # define GST_CAPS_INTERLACED_FALSE \
98 "interlace-mode = (string)progressive"
100 #define GST_VAAPI_MAKE_SURFACE_CAPS \
101 GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
102 GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
104 #define GST_VAAPI_MAKE_ENC_SURFACE_CAPS \
105 GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
106 GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, NV12, I420, YV12 }")
108 #define GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS \
109 GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
110 GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }")
114 gst_caps_set_interlaced (GstCaps * caps, GstVideoInfo * vip);
118 gst_caps_has_vaapi_surface (GstCaps * caps);
122 gst_video_info_change_format (GstVideoInfo * vip, GstVideoFormat format,
123 guint width, guint height);
127 gst_vaapi_create_test_display (void);
129 #endif /* GST_VAAPI_PLUGIN_UTIL_H */