typedef struct _GstVaapiFormatInfo GstVaapiFormatInfo;
struct _GstVaapiFormatInfo {
- GstVaapiImageFormat format;
+ GstVideoFormat format;
guint flags;
};
return g_type;
}
-/* Append GstVaapiImageFormat to formats array */
+/* Append GstVideoFormat to formats array */
static inline void
-append_format(GArray *formats, GstVaapiImageFormat format, guint flags)
+append_format(GArray *formats, GstVideoFormat format, guint flags)
{
GstVaapiFormatInfo fi;
append_formats(GArray *formats, const VAImageFormat *va_formats,
guint *flags, guint n)
{
- GstVaapiImageFormat format;
+ GstVideoFormat format;
const GstVaapiFormatInfo *YV12_fip = NULL;
const GstVaapiFormatInfo *I420_fip = NULL;
guint i;
const VAImageFormat * const va_format = &va_formats[i];
const GstVaapiFormatInfo **fipp;
- format = gst_vaapi_image_format(va_format);
- if (!format) {
+ format = gst_video_format_from_va_format(va_format);
+ if (format == GST_VIDEO_FORMAT_UNKNOWN) {
GST_DEBUG("unsupported format %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS(va_format->fourcc));
continue;
append_format(formats, format, flags ? flags[i] : 0);
switch (format) {
- case GST_VAAPI_IMAGE_YV12:
+ case GST_VIDEO_FORMAT_YV12:
fipp = &YV12_fip;
break;
- case GST_VAAPI_IMAGE_I420:
+ case GST_VIDEO_FORMAT_I420:
fipp = &I420_fip;
break;
default:
/* Append I420 (resp. YV12) format if YV12 (resp. I420) is not
supported by the underlying driver */
if (YV12_fip && !I420_fip)
- append_format(formats, GST_VAAPI_IMAGE_I420, YV12_fip->flags);
+ append_format(formats, GST_VIDEO_FORMAT_I420, YV12_fip->flags);
else if (I420_fip && !YV12_fip)
- append_format(formats, GST_VAAPI_IMAGE_YV12, I420_fip->flags);
+ append_format(formats, GST_VIDEO_FORMAT_YV12, I420_fip->flags);
}
/* Sort image formats. Prefer YUV formats first */
static gint
compare_yuv_formats(gconstpointer a, gconstpointer b)
{
- const GstVaapiImageFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
- const GstVaapiImageFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
+ const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
+ const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
- const gboolean is_fmt1_yuv = gst_vaapi_image_format_is_yuv(fmt1);
- const gboolean is_fmt2_yuv = gst_vaapi_image_format_is_yuv(fmt2);
+ const gboolean is_fmt1_yuv = gst_video_format_is_yuv(fmt1);
+ const gboolean is_fmt2_yuv = gst_video_format_is_yuv(fmt2);
if (is_fmt1_yuv != is_fmt2_yuv)
return is_fmt1_yuv ? -1 : 1;
- return ((gint)gst_vaapi_image_format_get_score(fmt1) -
- (gint)gst_vaapi_image_format_get_score(fmt2));
+ return ((gint)gst_video_format_get_score(fmt1) -
+ (gint)gst_video_format_get_score(fmt2));
}
/* Sort subpicture formats. Prefer RGB formats first */
static gint
compare_rgb_formats(gconstpointer a, gconstpointer b)
{
- const GstVaapiImageFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
- const GstVaapiImageFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
+ const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
+ const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
- const gboolean is_fmt1_rgb = gst_vaapi_image_format_is_rgb(fmt1);
- const gboolean is_fmt2_rgb = gst_vaapi_image_format_is_rgb(fmt2);
+ const gboolean is_fmt1_rgb = gst_video_format_is_rgb(fmt1);
+ const gboolean is_fmt2_rgb = gst_video_format_is_rgb(fmt2);
if (is_fmt1_rgb != is_fmt2_rgb)
return is_fmt1_rgb ? -1 : 1;
- return ((gint)gst_vaapi_image_format_get_score(fmt1) -
- (gint)gst_vaapi_image_format_get_score(fmt2));
+ return ((gint)gst_video_format_get_score(fmt1) -
+ (gint)gst_video_format_get_score(fmt2));
}
/* Check if configs array contains profile at entrypoint */
/* Find format info */
static const GstVaapiFormatInfo *
-find_format_info(GArray *formats, GstVaapiImageFormat format)
+find_format_info(GArray *formats, GstVideoFormat format)
{
const GstVaapiFormatInfo *fip;
guint i;
/* Check if formats array contains format */
static inline gboolean
-find_format(GArray *formats, GstVaapiImageFormat format)
+find_format(GArray *formats, GstVideoFormat format)
{
return find_format_info(formats, format) != NULL;
}
for (i = 0; i < formats->len; i++) {
fip = &g_array_index(formats, GstVaapiFormatInfo, i);
- caps = gst_vaapi_image_format_get_caps(fip->format);
+ caps = gst_video_format_to_caps(fip->format);
if (caps)
gst_caps_append(out_caps, caps);
}
/**
* gst_vaapi_display_has_image_format:
* @display: a #GstVaapiDisplay
- * @format: a #GstVaapiFormat
+ * @format: a #GstVideoFormat
*
* Returns whether VA @display supports @format image format.
*
gboolean
gst_vaapi_display_has_image_format(
GstVaapiDisplay *display,
- GstVaapiImageFormat format
+ GstVideoFormat format
)
{
g_return_val_if_fail(display != NULL, FALSE);
/**
* gst_vaapi_display_has_subpicture_format:
* @display: a #GstVaapiDisplay
- * @format: a #GstVaapiFormat
+ * @format: a #GstVideoFormat
* @flags_ptr: pointer to #GstVaapiSubpictureFlags, or zero
*
* Returns whether VA @display supports @format subpicture format with
gboolean
gst_vaapi_display_has_subpicture_format(
GstVaapiDisplay *display,
- GstVaapiImageFormat format,
+ GstVideoFormat format,
guint *flags_ptr
)
{
#include <va/va.h>
#include <gst/gst.h>
#include <gst/vaapi/gstvaapitypes.h>
-#include <gst/vaapi/gstvaapiimageformat.h>
#include <gst/vaapi/gstvaapiprofile.h>
+#include <gst/vaapi/video-format.h>
G_BEGIN_DECLS
gboolean
gst_vaapi_display_has_image_format(
GstVaapiDisplay *display,
- GstVaapiImageFormat format
+ GstVideoFormat format
);
GstCaps *
gboolean
gst_vaapi_display_has_subpicture_format(
GstVaapiDisplay *display,
- GstVaapiImageFormat format,
+ GstVideoFormat format,
guint *flags_ptr
);
VAImage internal_image;
VAImage image;
guchar *image_data;
- GstVaapiImageFormat internal_format;
- GstVaapiImageFormat format;
+ GstVideoFormat internal_format;
+ GstVideoFormat format;
guint width;
guint height;
guint is_linear : 1;
}
static gboolean
-_gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format)
+_gst_vaapi_image_create(GstVaapiImage *image, GstVideoFormat format)
{
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY(image);
const VAImageFormat *va_format;
if (!gst_vaapi_display_has_image_format(display, format))
return FALSE;
- va_format = gst_vaapi_image_format_get_va_format(format);
+ va_format = gst_video_format_to_va_format(format);
if (!va_format)
return FALSE;
}
static gboolean
-gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format,
+gst_vaapi_image_create(GstVaapiImage *image, GstVideoFormat format,
guint width, guint height)
{
const VAImageFormat *va_format;
if (!_gst_vaapi_image_create(image, format)) {
switch (format) {
- case GST_VAAPI_IMAGE_I420:
- format = GST_VAAPI_IMAGE_YV12;
+ case GST_VIDEO_FORMAT_I420:
+ format = GST_VIDEO_FORMAT_YV12;
break;
- case GST_VAAPI_IMAGE_YV12:
- format = GST_VAAPI_IMAGE_I420;
+ case GST_VIDEO_FORMAT_YV12:
+ format = GST_VIDEO_FORMAT_I420;
break;
default:
format = 0;
if (image->format != image->internal_format) {
switch (image->format) {
- case GST_VAAPI_IMAGE_YV12:
- case GST_VAAPI_IMAGE_I420:
- va_format = gst_vaapi_image_format_get_va_format(image->format);
+ case GST_VIDEO_FORMAT_YV12:
+ case GST_VIDEO_FORMAT_I420:
+ va_format = gst_video_format_to_va_format(image->format);
if (!va_format)
return FALSE;
image->image.format = *va_format;
/**
* gst_vaapi_image_new:
* @display: a #GstVaapiDisplay
- * @format: a #GstVaapiImageFormat
+ * @format: a #GstVideoFormat
* @width: the requested image width
* @height: the requested image height
*
GstVaapiImage *
gst_vaapi_image_new(
GstVaapiDisplay *display,
- GstVaapiImageFormat format,
+ GstVideoFormat format,
guint width,
guint height
)
gboolean
_gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
{
- GstVaapiImageFormat format;
+ GstVideoFormat format;
VAImage alt_va_image;
const VAImageFormat *alt_va_format;
- format = gst_vaapi_image_format(&va_image->format);
- if (!format)
+ format = gst_video_format_from_va_format(&va_image->format);
+ if (format == GST_VIDEO_FORMAT_UNKNOWN)
return FALSE;
image->internal_image = *va_image;
/* Try to linearize image */
if (!image->is_linear) {
switch (format) {
- case GST_VAAPI_IMAGE_I420:
- format = GST_VAAPI_IMAGE_YV12;
+ case GST_VIDEO_FORMAT_I420:
+ format = GST_VIDEO_FORMAT_YV12;
break;
- case GST_VAAPI_IMAGE_YV12:
- format = GST_VAAPI_IMAGE_I420;
+ case GST_VIDEO_FORMAT_YV12:
+ format = GST_VIDEO_FORMAT_I420;
break;
default:
format = 0;
break;
}
if (format &&
- (alt_va_format = gst_vaapi_image_format_get_va_format(format))) {
+ (alt_va_format = gst_video_format_to_va_format(format))) {
alt_va_image = *va_image;
alt_va_image.format = *alt_va_format;
SWAP_UINT(alt_va_image.offsets[1], alt_va_image.offsets[2]);
* gst_vaapi_image_get_format:
* @image: a #GstVaapiImage
*
- * Returns the #GstVaapiImageFormat the @image was created with.
+ * Returns the #GstVideoFormat the @image was created with.
*
- * Return value: the #GstVaapiImageFormat
+ * Return value: the #GstVideoFormat
*/
-GstVaapiImageFormat
+GstVideoFormat
gst_vaapi_image_get_format(GstVaapiImage *image)
{
g_return_val_if_fail(image != NULL, 0);
{
GstStructure *structure;
GstCaps *caps;
- GstVaapiImageFormat format;
+ GstVideoFormat format;
guint width2, height2, size2;
gint width, height;
guchar *data;
if (!caps)
return FALSE;
- format = gst_vaapi_image_format_from_caps(caps);
+ format = gst_video_format_from_caps(caps);
structure = gst_caps_get_structure(caps, 0);
gst_structure_get_int(structure, "width", &width);
height2 = (height + 1) / 2;
size2 = 0;
switch (format) {
- case GST_VAAPI_IMAGE_NV12:
+ case GST_VIDEO_FORMAT_NV12:
raw_image->num_planes = 2;
raw_image->pixels[0] = data;
raw_image->stride[0] = GST_ROUND_UP_4(width);
raw_image->stride[1] = raw_image->stride[0];
size2 += height2 * raw_image->stride[1];
break;
- case GST_VAAPI_IMAGE_YV12:
- case GST_VAAPI_IMAGE_I420:
+ case GST_VIDEO_FORMAT_YV12:
+ case GST_VIDEO_FORMAT_I420:
raw_image->num_planes = 3;
raw_image->pixels[0] = data;
raw_image->stride[0] = GST_ROUND_UP_4(width);
raw_image->stride[2] = raw_image->stride[1];
size2 += height2 * raw_image->stride[2];
break;
- case GST_VAAPI_IMAGE_ARGB:
- case GST_VAAPI_IMAGE_RGBA:
- case GST_VAAPI_IMAGE_ABGR:
- case GST_VAAPI_IMAGE_BGRA:
+ case GST_VIDEO_FORMAT_ARGB:
+ case GST_VIDEO_FORMAT_RGBA:
+ case GST_VIDEO_FORMAT_ABGR:
+ case GST_VIDEO_FORMAT_BGRA:
raw_image->num_planes = 1;
raw_image->pixels[0] = data;
raw_image->stride[0] = width * 4;
}
switch (dst_image->format) {
- case GST_VAAPI_IMAGE_NV12:
+ case GST_VIDEO_FORMAT_NV12:
copy_image_NV12(dst_image, src_image, rect);
break;
- case GST_VAAPI_IMAGE_YV12:
- case GST_VAAPI_IMAGE_I420:
+ case GST_VIDEO_FORMAT_YV12:
+ case GST_VIDEO_FORMAT_I420:
copy_image_YV12(dst_image, src_image, rect);
break;
- case GST_VAAPI_IMAGE_ARGB:
- case GST_VAAPI_IMAGE_RGBA:
- case GST_VAAPI_IMAGE_ABGR:
- case GST_VAAPI_IMAGE_BGRA:
+ case GST_VIDEO_FORMAT_ARGB:
+ case GST_VIDEO_FORMAT_RGBA:
+ case GST_VIDEO_FORMAT_ABGR:
+ case GST_VIDEO_FORMAT_BGRA:
copy_image_RGBA(dst_image, src_image, rect);
break;
default:
#include <gst/gstbuffer.h>
#include <gst/vaapi/gstvaapiobject.h>
#include <gst/vaapi/gstvaapidisplay.h>
-#include <gst/vaapi/gstvaapiimageformat.h>
+#include <gst/vaapi/video-format.h>
G_BEGIN_DECLS
* GST_VAAPI_IMAGE_FORMAT:
* @image: a #GstVaapiImage
*
- * Macro that evaluates to the #GstVaapiImageFormat of @image.
+ * Macro that evaluates to the #GstVideoFormat of @image.
*/
#define GST_VAAPI_IMAGE_FORMAT(image) gst_vaapi_image_get_format(image)
* the fields with sensible values.
*/
struct _GstVaapiImageRaw {
- GstVaapiImageFormat format;
+ GstVideoFormat format;
guint width;
guint height;
guint num_planes;
GstVaapiImage *
gst_vaapi_image_new(
GstVaapiDisplay *display,
- GstVaapiImageFormat format,
+ GstVideoFormat format,
guint width,
guint height
);
gboolean
gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
-GstVaapiImageFormat
+GstVideoFormat
gst_vaapi_image_get_format(GstVaapiImage *image);
guint
/*< private >*/
GstVaapiVideoPool parent_instance;
- GstVaapiImageFormat format;
+ GstVideoFormat format;
guint width;
guint height;
};
if (!gst_video_info_from_caps(&vi, caps))
return FALSE;
- pool->format = gst_vaapi_image_format_from_video(GST_VIDEO_INFO_FORMAT(&vi));
+ pool->format = GST_VIDEO_INFO_FORMAT(&vi);
pool->width = GST_VIDEO_INFO_WIDTH(&vi);
pool->height = GST_VIDEO_INFO_HEIGHT(&vi);
return TRUE;
{
GstVaapiSubpicture *subpicture;
GstVaapiDisplay *display;
- GstVaapiImageFormat format;
+ GstVideoFormat format;
guint va_flags;
g_return_val_if_fail(image != NULL, NULL);
)
{
GstVaapiSubpicture *subpicture;
- GstVaapiImageFormat format;
+ GstVideoFormat format;
GstVaapiImage *image;
GstVaapiImageRaw raw_image;
GstBuffer *buffer;
/* XXX: use gst_vaapi_image_format_from_video() */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- format = GST_VAAPI_IMAGE_BGRA;
+ format = GST_VIDEO_FORMAT_BGRA;
#else
- format = GST_VAAPI_IMAGE_ARGB;
+ format = GST_VIDEO_FORMAT_ARGB;
#endif
if (!gst_vaapi_display_has_subpicture_format(display, format, &hw_flags))
return NULL;