<SECTION>
<FILE>videoformat</FILE>
<TITLE>GstVideoFormat</TITLE>
-gst_video_format_from_caps
-gst_video_format_from_structure
-gst_video_format_from_va_format
-gst_video_format_get_chroma_type
-gst_video_format_get_score
-gst_video_format_is_rgb
-gst_video_format_is_yuv
-gst_video_format_to_caps
-gst_video_format_to_va_format
+gst_vaapi_video_format_from_caps
+gst_vaapi_video_format_from_structure
+gst_vaapi_video_format_from_va_format
+gst_vaapi_video_format_get_chroma_type
+gst_vaapi_video_format_get_score
+gst_vaapi_video_format_is_rgb
+gst_vaapi_video_format_is_yuv
+gst_vaapi_video_format_to_caps
+gst_vaapi_video_format_to_va_format
</SECTION>
<SECTION>
libgstvaapi_@GST_API_VERSION@_la_LDFLAGS = \
$(GST_ALL_LDFLAGS) \
$(GST_VAAPI_LT_LDFLAGS) \
- -export-symbols-regex "^gst_(.*vaapi|video_format).*" \
+ -export-symbols-regex "^gst_.*vaapi.*" \
$(NULL)
libgstvaapi_drm_@GST_API_VERSION@_la_SOURCES = \
const VAImageFormat * const va_format = &va_formats[i];
const GstVaapiFormatInfo **fipp;
- format = gst_video_format_from_va_format(va_format);
+ format = gst_vaapi_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));
const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
- const gboolean is_fmt1_yuv = gst_video_format_is_yuv(fmt1);
- const gboolean is_fmt2_yuv = gst_video_format_is_yuv(fmt2);
+ const gboolean is_fmt1_yuv = gst_vaapi_video_format_is_yuv(fmt1);
+ const gboolean is_fmt2_yuv = gst_vaapi_video_format_is_yuv(fmt2);
if (is_fmt1_yuv != is_fmt2_yuv)
return is_fmt1_yuv ? -1 : 1;
- return ((gint)gst_video_format_get_score(fmt1) -
- (gint)gst_video_format_get_score(fmt2));
+ return ((gint)gst_vaapi_video_format_get_score(fmt1) -
+ (gint)gst_vaapi_video_format_get_score(fmt2));
}
/* Sort subpicture formats. Prefer RGB formats first */
const GstVideoFormat fmt1 = ((GstVaapiFormatInfo *)a)->format;
const GstVideoFormat fmt2 = ((GstVaapiFormatInfo *)b)->format;
- const gboolean is_fmt1_rgb = gst_video_format_is_rgb(fmt1);
- const gboolean is_fmt2_rgb = gst_video_format_is_rgb(fmt2);
+ const gboolean is_fmt1_rgb = gst_vaapi_video_format_is_rgb(fmt1);
+ const gboolean is_fmt2_rgb = gst_vaapi_video_format_is_rgb(fmt2);
if (is_fmt1_rgb != is_fmt2_rgb)
return is_fmt1_rgb ? -1 : 1;
- return ((gint)gst_video_format_get_score(fmt1) -
- (gint)gst_video_format_get_score(fmt2));
+ return ((gint)gst_vaapi_video_format_get_score(fmt1) -
+ (gint)gst_vaapi_video_format_get_score(fmt2));
}
/* Check if configs array contains profile at entrypoint */
for (i = 0; i < formats->len; i++) {
fip = &g_array_index(formats, GstVaapiFormatInfo, i);
- caps = gst_video_format_to_caps(fip->format);
+ caps = gst_vaapi_video_format_to_caps(fip->format);
if (caps)
gst_caps_append(out_caps, caps);
}
if (!gst_vaapi_display_has_image_format(display, format))
return FALSE;
- va_format = gst_video_format_to_va_format(format);
+ va_format = gst_vaapi_video_format_to_va_format(format);
if (!va_format)
return FALSE;
switch (image->format) {
case GST_VIDEO_FORMAT_YV12:
case GST_VIDEO_FORMAT_I420:
- va_format = gst_video_format_to_va_format(image->format);
+ va_format = gst_vaapi_video_format_to_va_format(image->format);
if (!va_format)
return FALSE;
image->image.format = *va_format;
VAImage alt_va_image;
const VAImageFormat *alt_va_format;
- format = gst_video_format_from_va_format(&va_image->format);
+ format = gst_vaapi_video_format_from_va_format(&va_image->format);
if (format == GST_VIDEO_FORMAT_UNKNOWN)
return FALSE;
break;
}
if (format &&
- (alt_va_format = gst_video_format_to_va_format(format))) {
+ (alt_va_format = gst_vaapi_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]);
const VAImageFormat *va_format;
VASurfaceAttrib attrib;
- va_format = gst_video_format_to_va_format(format);
+ va_format = gst_vaapi_video_format_to_va_format(format);
if (!va_format)
goto error_unsupported_format;
- chroma_type = gst_video_format_get_chroma_type(format);
+ chroma_type = gst_vaapi_video_format_get_chroma_type(format);
if (!chroma_type)
goto error_unsupported_format;
if (pool->format == GST_VIDEO_FORMAT_ENCODED)
pool->chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
else
- pool->chroma_type = gst_video_format_get_chroma_type(pool->format);
+ pool->chroma_type = gst_vaapi_video_format_get_chroma_type(pool->format);
if (!pool->chroma_type)
return FALSE;
return TRUE;
/*
- * video-format.c - Video format abstraction
+ * video-format.h - Video format helpers for VA-API
*
* Copyright (C) 2010-2011 Splitted-Desktop Systems
* Copyright (C) 2011-2013 Intel Corporation
/**
* SECTION:videoformat
- * @short_description: Video format abstraction
+ * @short_description: Video format helpers for VA-API
*/
#include "sysdeps.h"
{ VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, DEPTH, R,G,B,A }, }
/* Image formats, listed in HW order preference */
-static const GstVideoFormatMap gst_video_formats[] = {
+static const GstVideoFormatMap gst_vaapi_video_formats[] = {
DEF_YUV(NV12, ('N','V','1','2'), LSB, 12, 420),
DEF_YUV(YV12, ('Y','V','1','2'), LSB, 12, 420),
DEF_YUV(I420, ('I','4','2','0'), LSB, 12, 420),
{
const GstVideoFormatMap *m;
- for (m = gst_video_formats; m->format; m++) {
+ for (m = gst_vaapi_video_formats; m->format; m++) {
if (m->format == format)
return m;
}
}
/**
- * gst_video_format_is_rgb:
+ * gst_vaapi_video_format_is_rgb:
* @format: a #GstVideoFormat
*
* Checks whether the format is an RGB format.
*
* Return value: %TRUE if @format is RGB format
*/
-#if GST_CHECK_VERSION(1,0,0)
gboolean
-gst_video_format_is_rgb(GstVideoFormat format)
+gst_vaapi_video_format_is_rgb(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
return m && va_format_is_rgb(&m->va_format);
}
-#endif
/**
- * gst_video_format_is_yuv:
+ * gst_vaapi_video_format_is_yuv:
* @format: a #GstVideoFormat
*
* Checks whether the format is an YUV format.
*
* Return value: %TRUE if @format is YUV format
*/
-#if GST_CHECK_VERSION(1,0,0)
gboolean
-gst_video_format_is_yuv(GstVideoFormat format)
+gst_vaapi_video_format_is_yuv(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
return m && va_format_is_yuv(&m->va_format);
}
-#endif
/**
- * gst_video_format_from_caps:
+ * gst_vaapi_video_format_from_caps:
* @caps: a #GstCaps
*
* Converts @caps into the corresponding #GstVideoFormat. If the
* Return value: the #GstVideoFormat describing the @caps
*/
GstVideoFormat
-gst_video_format_from_caps(GstCaps *caps)
+gst_vaapi_video_format_from_caps(GstCaps *caps)
{
GstStructure *structure;
structure = gst_caps_get_structure(caps, 0);
if (!structure)
return 0;
- return gst_video_format_from_structure(structure);
+ return gst_vaapi_video_format_from_structure(structure);
}
/**
- * gst_video_format_from_structure:
+ * gst_vaapi_video_format_from_structure:
* @structure: a #GstStructure
*
* Converts @structure into the corresponding #GstVideoFormat. If
* Return value: the #GstVideoFormat describing the @structure
*/
GstVideoFormat
-gst_video_format_from_structure(GstStructure *structure)
+gst_vaapi_video_format_from_structure(GstStructure *structure)
{
#if GST_CHECK_VERSION(1,0,0)
const gchar * format = gst_structure_get_string(structure, "format");
va_format->blue_mask = GUINT32_SWAP_LE_BE(bmask);
va_format->alpha_mask = GUINT32_SWAP_LE_BE(amask);
- for (m = gst_video_formats; m->format; m++) {
+ for (m = gst_vaapi_video_formats; m->format; m++) {
if (va_format_is_rgb(&m->va_format) &&
(va_format_is_same_rgb(&m->va_format, &va_formats[0]) ||
va_format_is_same_rgb(&m->va_format, &va_formats[1])))
}
/**
- * gst_video_format_to_caps:
+ * gst_vaapi_video_format_to_caps:
* @format: a #GstVideoFormat
*
* Converts a #GstVideoFormat into the corresponding #GstCaps. If
* Return value: the newly allocated #GstCaps, or %NULL if none was found
*/
GstCaps *
-gst_video_format_to_caps(GstVideoFormat format)
+gst_vaapi_video_format_to_caps(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
}
/**
- * gst_video_format_from_va_format:
+ * gst_vaapi_video_format_from_va_format:
* @va_format: a #VAImageFormat
*
* Converts a VA image format into the corresponding #GstVideoFormat.
* Return value: the #GstVideoFormat describing the @va_format
*/
GstVideoFormat
-gst_video_format_from_va_format(const VAImageFormat *va_format)
+gst_vaapi_video_format_from_va_format(const VAImageFormat *va_format)
{
const GstVideoFormatMap *m;
- for (m = gst_video_formats; m->format; m++) {
+ for (m = gst_vaapi_video_formats; m->format; m++) {
if (va_format_is_same(&m->va_format, va_format))
return m->format;
}
}
/**
- * gst_video_format_to_va_format:
+ * gst_vaapi_video_format_to_va_format:
* @format: a #GstVideoFormat
*
* Converts a #GstVideoFormat into the corresponding VA image
* Return value: the VA image format, or %NULL if none was found
*/
const VAImageFormat *
-gst_video_format_to_va_format(GstVideoFormat format)
+gst_vaapi_video_format_to_va_format(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
}
/**
- * gst_video_format_get_chroma_type:
+ * gst_vaapi_video_format_get_chroma_type:
* @format: a #GstVideoFormat
*
* Converts a #GstVideoFormat into the corresponding #GstVaapiChromaType
* was found.
*/
guint
-gst_video_format_get_chroma_type(GstVideoFormat format)
+gst_vaapi_video_format_get_chroma_type(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
}
/**
- * gst_video_format_get_score:
+ * gst_vaapi_video_format_get_score:
* @format: a #GstVideoFormat
*
* Determines how "native" is this @format. The lower is the returned
* Return value: the @format score, or %G_MAXUINT if none was found
*/
guint
-gst_video_format_get_score(GstVideoFormat format)
+gst_vaapi_video_format_get_score(GstVideoFormat format)
{
const GstVideoFormatMap * const m = get_map(format);
- return m ? (m - &gst_video_formats[0]) : G_MAXUINT;
+ return m ? (m - &gst_vaapi_video_formats[0]) : G_MAXUINT;
}
/*
- * video-format.h - Video format abstraction
+ * video-format.h - Video format helpers for VA-API
*
* Copyright (C) 2010-2011 Splitted-Desktop Systems
* Copyright (C) 2011-2013 Intel Corporation
G_BEGIN_DECLS
gboolean
-gst_video_format_is_rgb(GstVideoFormat format);
+gst_vaapi_video_format_is_rgb(GstVideoFormat format);
gboolean
-gst_video_format_is_yuv(GstVideoFormat format);
+gst_vaapi_video_format_is_yuv(GstVideoFormat format);
GstVideoFormat
-gst_video_format_from_structure(GstStructure *structure);
+gst_vaapi_video_format_from_structure(GstStructure *structure);
GstVideoFormat
-gst_video_format_from_caps(GstCaps *caps);
+gst_vaapi_video_format_from_caps(GstCaps *caps);
GstCaps *
-gst_video_format_to_caps(GstVideoFormat format);
+gst_vaapi_video_format_to_caps(GstVideoFormat format);
GstVideoFormat
-gst_video_format_from_va_format(const VAImageFormat *va_format);
+gst_vaapi_video_format_from_va_format(const VAImageFormat *va_format);
const VAImageFormat *
-gst_video_format_to_va_format(GstVideoFormat format);
+gst_vaapi_video_format_to_va_format(GstVideoFormat format);
guint
-gst_video_format_get_chroma_type(GstVideoFormat format);
+gst_vaapi_video_format_get_chroma_type(GstVideoFormat format);
guint
-gst_video_format_get_score(GstVideoFormat format);
+gst_vaapi_video_format_get_score(GstVideoFormat format);
G_END_DECLS
return FALSE;
}
- out_caps = gst_video_format_to_caps(download->image_format);
+ out_caps = gst_vaapi_video_format_to_caps(download->image_format);
if (!out_caps) {
GST_WARNING("failed to create caps from format %s",
gst_video_format_to_string(download->image_format));
GstVaapiImage *image;
GstVideoFormat format;
- format = gst_video_format_from_structure(structure);
+ format = gst_vaapi_video_format_from_structure(structure);
if (format == GST_VIDEO_FORMAT_UNKNOWN)
continue;
image = gst_vaapi_image_new(priv->display, format, WIDTH, HEIGHT);
/* XXX: this also means that visual quality is not preserved */
if (format != GST_VIDEO_FORMAT_ENCODED) {
const GstVaapiChromaType chroma_type =
- gst_video_format_get_chroma_type(format);
+ gst_vaapi_video_format_get_chroma_type(format);
if (chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) {
const GstVideoFormat image_format =
GST_VIDEO_INFO_FORMAT(&priv->image_info);
stride[i] = gst_vaapi_image_get_pitch(image, i);
}
- if (gst_video_format_is_yuv(image_format))
+ if (gst_vaapi_video_format_is_yuv(image_format))
color = argb2yuv(color);
if (x < 0)
g_print(" %s:", gst_structure_get_name(structure));
- format = gst_video_format_from_structure(structure);
+ format = gst_vaapi_video_format_from_structure(structure);
if (format == GST_VIDEO_FORMAT_UNKNOWN)
g_error("could not determine format");
- va_format = gst_video_format_to_va_format(format);
+ va_format = gst_vaapi_video_format_to_va_format(format);
if (!va_format)
g_error("could not determine VA format");
- if (gst_video_format_is_yuv(format))
+ if (gst_vaapi_video_format_is_yuv(format))
print_format_caps_yuv(va_format);
else
print_format_caps_rgb(va_format);