mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
libs: port to new video format API.
This commit is contained in:
parent
430598cf00
commit
e61c5fc3d1
6 changed files with 84 additions and 84 deletions
|
@ -59,7 +59,7 @@ struct _GstVaapiProperty {
|
||||||
|
|
||||||
typedef struct _GstVaapiFormatInfo GstVaapiFormatInfo;
|
typedef struct _GstVaapiFormatInfo GstVaapiFormatInfo;
|
||||||
struct _GstVaapiFormatInfo {
|
struct _GstVaapiFormatInfo {
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint flags;
|
guint flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,9 +174,9 @@ gst_vaapi_display_type_get_type(void)
|
||||||
return g_type;
|
return g_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append GstVaapiImageFormat to formats array */
|
/* Append GstVideoFormat to formats array */
|
||||||
static inline void
|
static inline void
|
||||||
append_format(GArray *formats, GstVaapiImageFormat format, guint flags)
|
append_format(GArray *formats, GstVideoFormat format, guint flags)
|
||||||
{
|
{
|
||||||
GstVaapiFormatInfo fi;
|
GstVaapiFormatInfo fi;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ static void
|
||||||
append_formats(GArray *formats, const VAImageFormat *va_formats,
|
append_formats(GArray *formats, const VAImageFormat *va_formats,
|
||||||
guint *flags, guint n)
|
guint *flags, guint n)
|
||||||
{
|
{
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
const GstVaapiFormatInfo *YV12_fip = NULL;
|
const GstVaapiFormatInfo *YV12_fip = NULL;
|
||||||
const GstVaapiFormatInfo *I420_fip = NULL;
|
const GstVaapiFormatInfo *I420_fip = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
@ -199,8 +199,8 @@ append_formats(GArray *formats, const VAImageFormat *va_formats,
|
||||||
const VAImageFormat * const va_format = &va_formats[i];
|
const VAImageFormat * const va_format = &va_formats[i];
|
||||||
const GstVaapiFormatInfo **fipp;
|
const GstVaapiFormatInfo **fipp;
|
||||||
|
|
||||||
format = gst_vaapi_image_format(va_format);
|
format = gst_video_format_from_va_format(va_format);
|
||||||
if (!format) {
|
if (format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||||
GST_DEBUG("unsupported format %" GST_FOURCC_FORMAT,
|
GST_DEBUG("unsupported format %" GST_FOURCC_FORMAT,
|
||||||
GST_FOURCC_ARGS(va_format->fourcc));
|
GST_FOURCC_ARGS(va_format->fourcc));
|
||||||
continue;
|
continue;
|
||||||
|
@ -208,10 +208,10 @@ append_formats(GArray *formats, const VAImageFormat *va_formats,
|
||||||
append_format(formats, format, flags ? flags[i] : 0);
|
append_format(formats, format, flags ? flags[i] : 0);
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
fipp = &YV12_fip;
|
fipp = &YV12_fip;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
fipp = &I420_fip;
|
fipp = &I420_fip;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -226,43 +226,43 @@ append_formats(GArray *formats, const VAImageFormat *va_formats,
|
||||||
/* Append I420 (resp. YV12) format if YV12 (resp. I420) is not
|
/* Append I420 (resp. YV12) format if YV12 (resp. I420) is not
|
||||||
supported by the underlying driver */
|
supported by the underlying driver */
|
||||||
if (YV12_fip && !I420_fip)
|
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)
|
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 */
|
/* Sort image formats. Prefer YUV formats first */
|
||||||
static gint
|
static gint
|
||||||
compare_yuv_formats(gconstpointer a, gconstpointer b)
|
compare_yuv_formats(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const GstVaapiImageFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
|
const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
|
||||||
const GstVaapiImageFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
|
const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
|
||||||
|
|
||||||
const gboolean is_fmt1_yuv = gst_vaapi_image_format_is_yuv(fmt1);
|
const gboolean is_fmt1_yuv = gst_video_format_is_yuv(fmt1);
|
||||||
const gboolean is_fmt2_yuv = gst_vaapi_image_format_is_yuv(fmt2);
|
const gboolean is_fmt2_yuv = gst_video_format_is_yuv(fmt2);
|
||||||
|
|
||||||
if (is_fmt1_yuv != is_fmt2_yuv)
|
if (is_fmt1_yuv != is_fmt2_yuv)
|
||||||
return is_fmt1_yuv ? -1 : 1;
|
return is_fmt1_yuv ? -1 : 1;
|
||||||
|
|
||||||
return ((gint)gst_vaapi_image_format_get_score(fmt1) -
|
return ((gint)gst_video_format_get_score(fmt1) -
|
||||||
(gint)gst_vaapi_image_format_get_score(fmt2));
|
(gint)gst_video_format_get_score(fmt2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort subpicture formats. Prefer RGB formats first */
|
/* Sort subpicture formats. Prefer RGB formats first */
|
||||||
static gint
|
static gint
|
||||||
compare_rgb_formats(gconstpointer a, gconstpointer b)
|
compare_rgb_formats(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const GstVaapiImageFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
|
const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
|
||||||
const GstVaapiImageFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
|
const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
|
||||||
|
|
||||||
const gboolean is_fmt1_rgb = gst_vaapi_image_format_is_rgb(fmt1);
|
const gboolean is_fmt1_rgb = gst_video_format_is_rgb(fmt1);
|
||||||
const gboolean is_fmt2_rgb = gst_vaapi_image_format_is_rgb(fmt2);
|
const gboolean is_fmt2_rgb = gst_video_format_is_rgb(fmt2);
|
||||||
|
|
||||||
if (is_fmt1_rgb != is_fmt2_rgb)
|
if (is_fmt1_rgb != is_fmt2_rgb)
|
||||||
return is_fmt1_rgb ? -1 : 1;
|
return is_fmt1_rgb ? -1 : 1;
|
||||||
|
|
||||||
return ((gint)gst_vaapi_image_format_get_score(fmt1) -
|
return ((gint)gst_video_format_get_score(fmt1) -
|
||||||
(gint)gst_vaapi_image_format_get_score(fmt2));
|
(gint)gst_video_format_get_score(fmt2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if configs array contains profile at entrypoint */
|
/* Check if configs array contains profile at entrypoint */
|
||||||
|
@ -343,7 +343,7 @@ get_profile_caps(GArray *configs)
|
||||||
|
|
||||||
/* Find format info */
|
/* Find format info */
|
||||||
static const GstVaapiFormatInfo *
|
static const GstVaapiFormatInfo *
|
||||||
find_format_info(GArray *formats, GstVaapiImageFormat format)
|
find_format_info(GArray *formats, GstVideoFormat format)
|
||||||
{
|
{
|
||||||
const GstVaapiFormatInfo *fip;
|
const GstVaapiFormatInfo *fip;
|
||||||
guint i;
|
guint i;
|
||||||
|
@ -358,7 +358,7 @@ find_format_info(GArray *formats, GstVaapiImageFormat format)
|
||||||
|
|
||||||
/* Check if formats array contains format */
|
/* Check if formats array contains format */
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
find_format(GArray *formats, GstVaapiImageFormat format)
|
find_format(GArray *formats, GstVideoFormat format)
|
||||||
{
|
{
|
||||||
return find_format_info(formats, format) != NULL;
|
return find_format_info(formats, format) != NULL;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ get_format_caps(GArray *formats)
|
||||||
|
|
||||||
for (i = 0; i < formats->len; i++) {
|
for (i = 0; i < formats->len; i++) {
|
||||||
fip = &g_array_index(formats, GstVaapiFormatInfo, 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)
|
if (caps)
|
||||||
gst_caps_append(out_caps, caps);
|
gst_caps_append(out_caps, caps);
|
||||||
}
|
}
|
||||||
|
@ -1360,7 +1360,7 @@ gst_vaapi_display_get_image_caps(GstVaapiDisplay *display)
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_display_has_image_format:
|
* gst_vaapi_display_has_image_format:
|
||||||
* @display: a #GstVaapiDisplay
|
* @display: a #GstVaapiDisplay
|
||||||
* @format: a #GstVaapiFormat
|
* @format: a #GstVideoFormat
|
||||||
*
|
*
|
||||||
* Returns whether VA @display supports @format image format.
|
* Returns whether VA @display supports @format image format.
|
||||||
*
|
*
|
||||||
|
@ -1369,7 +1369,7 @@ gst_vaapi_display_get_image_caps(GstVaapiDisplay *display)
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_image_format(
|
gst_vaapi_display_has_image_format(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format
|
GstVideoFormat format
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(display != NULL, FALSE);
|
g_return_val_if_fail(display != NULL, FALSE);
|
||||||
|
@ -1412,7 +1412,7 @@ gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display)
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_display_has_subpicture_format:
|
* gst_vaapi_display_has_subpicture_format:
|
||||||
* @display: a #GstVaapiDisplay
|
* @display: a #GstVaapiDisplay
|
||||||
* @format: a #GstVaapiFormat
|
* @format: a #GstVideoFormat
|
||||||
* @flags_ptr: pointer to #GstVaapiSubpictureFlags, or zero
|
* @flags_ptr: pointer to #GstVaapiSubpictureFlags, or zero
|
||||||
*
|
*
|
||||||
* Returns whether VA @display supports @format subpicture format with
|
* Returns whether VA @display supports @format subpicture format with
|
||||||
|
@ -1423,7 +1423,7 @@ gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display)
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_subpicture_format(
|
gst_vaapi_display_has_subpicture_format(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format,
|
GstVideoFormat format,
|
||||||
guint *flags_ptr
|
guint *flags_ptr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include <va/va.h>
|
#include <va/va.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/vaapi/gstvaapitypes.h>
|
#include <gst/vaapi/gstvaapitypes.h>
|
||||||
#include <gst/vaapi/gstvaapiimageformat.h>
|
|
||||||
#include <gst/vaapi/gstvaapiprofile.h>
|
#include <gst/vaapi/gstvaapiprofile.h>
|
||||||
|
#include <gst/vaapi/video-format.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ gst_vaapi_display_get_image_caps(GstVaapiDisplay *display);
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_image_format(
|
gst_vaapi_display_has_image_format(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format
|
GstVideoFormat format
|
||||||
);
|
);
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
|
@ -170,7 +170,7 @@ gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display);
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_subpicture_format(
|
gst_vaapi_display_has_subpicture_format(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format,
|
GstVideoFormat format,
|
||||||
guint *flags_ptr
|
guint *flags_ptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ struct _GstVaapiImage {
|
||||||
VAImage internal_image;
|
VAImage internal_image;
|
||||||
VAImage image;
|
VAImage image;
|
||||||
guchar *image_data;
|
guchar *image_data;
|
||||||
GstVaapiImageFormat internal_format;
|
GstVideoFormat internal_format;
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
guint is_linear : 1;
|
guint is_linear : 1;
|
||||||
|
@ -143,7 +143,7 @@ gst_vaapi_image_destroy(GstVaapiImage *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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);
|
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY(image);
|
||||||
const VAImageFormat *va_format;
|
const VAImageFormat *va_format;
|
||||||
|
@ -152,7 +152,7 @@ _gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format)
|
||||||
if (!gst_vaapi_display_has_image_format(display, format))
|
if (!gst_vaapi_display_has_image_format(display, format))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
va_format = gst_vaapi_image_format_get_va_format(format);
|
va_format = gst_video_format_to_va_format(format);
|
||||||
if (!va_format)
|
if (!va_format)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ _gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format,
|
gst_vaapi_image_create(GstVaapiImage *image, GstVideoFormat format,
|
||||||
guint width, guint height)
|
guint width, guint height)
|
||||||
{
|
{
|
||||||
const VAImageFormat *va_format;
|
const VAImageFormat *va_format;
|
||||||
|
@ -186,11 +186,11 @@ gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format,
|
||||||
|
|
||||||
if (!_gst_vaapi_image_create(image, format)) {
|
if (!_gst_vaapi_image_create(image, format)) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
format = GST_VAAPI_IMAGE_YV12;
|
format = GST_VIDEO_FORMAT_YV12;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
format = GST_VAAPI_IMAGE_I420;
|
format = GST_VIDEO_FORMAT_I420;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
format = 0;
|
format = 0;
|
||||||
|
@ -204,9 +204,9 @@ gst_vaapi_image_create(GstVaapiImage *image, GstVaapiImageFormat format,
|
||||||
|
|
||||||
if (image->format != image->internal_format) {
|
if (image->format != image->internal_format) {
|
||||||
switch (image->format) {
|
switch (image->format) {
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
va_format = gst_vaapi_image_format_get_va_format(image->format);
|
va_format = gst_video_format_to_va_format(image->format);
|
||||||
if (!va_format)
|
if (!va_format)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
image->image.format = *va_format;
|
image->image.format = *va_format;
|
||||||
|
@ -251,7 +251,7 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_image_new:
|
* gst_vaapi_image_new:
|
||||||
* @display: a #GstVaapiDisplay
|
* @display: a #GstVaapiDisplay
|
||||||
* @format: a #GstVaapiImageFormat
|
* @format: a #GstVideoFormat
|
||||||
* @width: the requested image width
|
* @width: the requested image width
|
||||||
* @height: the requested image height
|
* @height: the requested image height
|
||||||
*
|
*
|
||||||
|
@ -263,7 +263,7 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(
|
||||||
GstVaapiImage *
|
GstVaapiImage *
|
||||||
gst_vaapi_image_new(
|
gst_vaapi_image_new(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format,
|
GstVideoFormat format,
|
||||||
guint width,
|
guint width,
|
||||||
guint height
|
guint height
|
||||||
)
|
)
|
||||||
|
@ -381,12 +381,12 @@ gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image)
|
||||||
gboolean
|
gboolean
|
||||||
_gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
|
_gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
|
||||||
{
|
{
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
VAImage alt_va_image;
|
VAImage alt_va_image;
|
||||||
const VAImageFormat *alt_va_format;
|
const VAImageFormat *alt_va_format;
|
||||||
|
|
||||||
format = gst_vaapi_image_format(&va_image->format);
|
format = gst_video_format_from_va_format(&va_image->format);
|
||||||
if (!format)
|
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
image->internal_image = *va_image;
|
image->internal_image = *va_image;
|
||||||
|
@ -402,18 +402,18 @@ _gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
|
||||||
/* Try to linearize image */
|
/* Try to linearize image */
|
||||||
if (!image->is_linear) {
|
if (!image->is_linear) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
format = GST_VAAPI_IMAGE_YV12;
|
format = GST_VIDEO_FORMAT_YV12;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
format = GST_VAAPI_IMAGE_I420;
|
format = GST_VIDEO_FORMAT_I420;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
format = 0;
|
format = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (format &&
|
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 = *va_image;
|
||||||
alt_va_image.format = *alt_va_format;
|
alt_va_image.format = *alt_va_format;
|
||||||
SWAP_UINT(alt_va_image.offsets[1], alt_va_image.offsets[2]);
|
SWAP_UINT(alt_va_image.offsets[1], alt_va_image.offsets[2]);
|
||||||
|
@ -434,11 +434,11 @@ _gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
|
||||||
* gst_vaapi_image_get_format:
|
* gst_vaapi_image_get_format:
|
||||||
* @image: a #GstVaapiImage
|
* @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)
|
gst_vaapi_image_get_format(GstVaapiImage *image)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(image != NULL, 0);
|
g_return_val_if_fail(image != NULL, 0);
|
||||||
|
@ -737,7 +737,7 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint width2, height2, size2;
|
guint width2, height2, size2;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
|
@ -750,7 +750,7 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||||
if (!caps)
|
if (!caps)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
format = gst_vaapi_image_format_from_caps(caps);
|
format = gst_video_format_from_caps(caps);
|
||||||
|
|
||||||
structure = gst_caps_get_structure(caps, 0);
|
structure = gst_caps_get_structure(caps, 0);
|
||||||
gst_structure_get_int(structure, "width", &width);
|
gst_structure_get_int(structure, "width", &width);
|
||||||
|
@ -764,7 +764,7 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||||
height2 = (height + 1) / 2;
|
height2 = (height + 1) / 2;
|
||||||
size2 = 0;
|
size2 = 0;
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_VAAPI_IMAGE_NV12:
|
case GST_VIDEO_FORMAT_NV12:
|
||||||
raw_image->num_planes = 2;
|
raw_image->num_planes = 2;
|
||||||
raw_image->pixels[0] = data;
|
raw_image->pixels[0] = data;
|
||||||
raw_image->stride[0] = GST_ROUND_UP_4(width);
|
raw_image->stride[0] = GST_ROUND_UP_4(width);
|
||||||
|
@ -773,8 +773,8 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||||
raw_image->stride[1] = raw_image->stride[0];
|
raw_image->stride[1] = raw_image->stride[0];
|
||||||
size2 += height2 * raw_image->stride[1];
|
size2 += height2 * raw_image->stride[1];
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
raw_image->num_planes = 3;
|
raw_image->num_planes = 3;
|
||||||
raw_image->pixels[0] = data;
|
raw_image->pixels[0] = data;
|
||||||
raw_image->stride[0] = GST_ROUND_UP_4(width);
|
raw_image->stride[0] = GST_ROUND_UP_4(width);
|
||||||
|
@ -786,10 +786,10 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||||
raw_image->stride[2] = raw_image->stride[1];
|
raw_image->stride[2] = raw_image->stride[1];
|
||||||
size2 += height2 * raw_image->stride[2];
|
size2 += height2 * raw_image->stride[2];
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_ARGB:
|
case GST_VIDEO_FORMAT_ARGB:
|
||||||
case GST_VAAPI_IMAGE_RGBA:
|
case GST_VIDEO_FORMAT_RGBA:
|
||||||
case GST_VAAPI_IMAGE_ABGR:
|
case GST_VIDEO_FORMAT_ABGR:
|
||||||
case GST_VAAPI_IMAGE_BGRA:
|
case GST_VIDEO_FORMAT_BGRA:
|
||||||
raw_image->num_planes = 1;
|
raw_image->num_planes = 1;
|
||||||
raw_image->pixels[0] = data;
|
raw_image->pixels[0] = data;
|
||||||
raw_image->stride[0] = width * 4;
|
raw_image->stride[0] = width * 4;
|
||||||
|
@ -937,17 +937,17 @@ copy_image(
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst_image->format) {
|
switch (dst_image->format) {
|
||||||
case GST_VAAPI_IMAGE_NV12:
|
case GST_VIDEO_FORMAT_NV12:
|
||||||
copy_image_NV12(dst_image, src_image, rect);
|
copy_image_NV12(dst_image, src_image, rect);
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
case GST_VAAPI_IMAGE_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
copy_image_YV12(dst_image, src_image, rect);
|
copy_image_YV12(dst_image, src_image, rect);
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_IMAGE_ARGB:
|
case GST_VIDEO_FORMAT_ARGB:
|
||||||
case GST_VAAPI_IMAGE_RGBA:
|
case GST_VIDEO_FORMAT_RGBA:
|
||||||
case GST_VAAPI_IMAGE_ABGR:
|
case GST_VIDEO_FORMAT_ABGR:
|
||||||
case GST_VAAPI_IMAGE_BGRA:
|
case GST_VIDEO_FORMAT_BGRA:
|
||||||
copy_image_RGBA(dst_image, src_image, rect);
|
copy_image_RGBA(dst_image, src_image, rect);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <gst/gstbuffer.h>
|
#include <gst/gstbuffer.h>
|
||||||
#include <gst/vaapi/gstvaapiobject.h>
|
#include <gst/vaapi/gstvaapiobject.h>
|
||||||
#include <gst/vaapi/gstvaapidisplay.h>
|
#include <gst/vaapi/gstvaapidisplay.h>
|
||||||
#include <gst/vaapi/gstvaapiimageformat.h>
|
#include <gst/vaapi/video-format.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ G_BEGIN_DECLS
|
||||||
* GST_VAAPI_IMAGE_FORMAT:
|
* GST_VAAPI_IMAGE_FORMAT:
|
||||||
* @image: a #GstVaapiImage
|
* @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)
|
#define GST_VAAPI_IMAGE_FORMAT(image) gst_vaapi_image_get_format(image)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ typedef struct _GstVaapiImageRaw GstVaapiImageRaw;
|
||||||
* the fields with sensible values.
|
* the fields with sensible values.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiImageRaw {
|
struct _GstVaapiImageRaw {
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
guint num_planes;
|
guint num_planes;
|
||||||
|
@ -78,7 +78,7 @@ struct _GstVaapiImageRaw {
|
||||||
GstVaapiImage *
|
GstVaapiImage *
|
||||||
gst_vaapi_image_new(
|
gst_vaapi_image_new(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiImageFormat format,
|
GstVideoFormat format,
|
||||||
guint width,
|
guint width,
|
||||||
guint height
|
guint height
|
||||||
);
|
);
|
||||||
|
@ -92,7 +92,7 @@ gst_vaapi_image_get_id(GstVaapiImage *image);
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
|
gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
|
||||||
|
|
||||||
GstVaapiImageFormat
|
GstVideoFormat
|
||||||
gst_vaapi_image_get_format(GstVaapiImage *image);
|
gst_vaapi_image_get_format(GstVaapiImage *image);
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct _GstVaapiImagePool {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GstVaapiVideoPool parent_instance;
|
GstVaapiVideoPool parent_instance;
|
||||||
|
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ gst_vaapi_image_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps)
|
||||||
if (!gst_video_info_from_caps(&vi, caps))
|
if (!gst_video_info_from_caps(&vi, caps))
|
||||||
return FALSE;
|
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->width = GST_VIDEO_INFO_WIDTH(&vi);
|
||||||
pool->height = GST_VIDEO_INFO_HEIGHT(&vi);
|
pool->height = GST_VIDEO_INFO_HEIGHT(&vi);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -132,7 +132,7 @@ gst_vaapi_subpicture_new(GstVaapiImage *image, guint flags)
|
||||||
{
|
{
|
||||||
GstVaapiSubpicture *subpicture;
|
GstVaapiSubpicture *subpicture;
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
guint va_flags;
|
guint va_flags;
|
||||||
|
|
||||||
g_return_val_if_fail(image != NULL, NULL);
|
g_return_val_if_fail(image != NULL, NULL);
|
||||||
|
@ -180,7 +180,7 @@ gst_vaapi_subpicture_new_from_overlay_rectangle(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GstVaapiSubpicture *subpicture;
|
GstVaapiSubpicture *subpicture;
|
||||||
GstVaapiImageFormat format;
|
GstVideoFormat format;
|
||||||
GstVaapiImage *image;
|
GstVaapiImage *image;
|
||||||
GstVaapiImageRaw raw_image;
|
GstVaapiImageRaw raw_image;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
@ -197,9 +197,9 @@ gst_vaapi_subpicture_new_from_overlay_rectangle(
|
||||||
|
|
||||||
/* XXX: use gst_vaapi_image_format_from_video() */
|
/* XXX: use gst_vaapi_image_format_from_video() */
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
format = GST_VAAPI_IMAGE_BGRA;
|
format = GST_VIDEO_FORMAT_BGRA;
|
||||||
#else
|
#else
|
||||||
format = GST_VAAPI_IMAGE_ARGB;
|
format = GST_VIDEO_FORMAT_ARGB;
|
||||||
#endif
|
#endif
|
||||||
if (!gst_vaapi_display_has_subpicture_format(display, format, &hw_flags))
|
if (!gst_vaapi_display_has_subpicture_format(display, format, &hw_flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue