Fix new video format API.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 15 Jul 2013 12:42:33 +0000 (14:42 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 15 Jul 2013 12:42:33 +0000 (14:42 +0200)
Fix new internal video format API, based on GstVideoFormat, to not
clobber with system symbols. So replace the gst_video_format_* prefix
with gst_vaapi_video_format_ prefix, even if the format type remains
GstVideoFormat.

12 files changed:
docs/reference/libs/libs-sections.txt
gst-libs/gst/vaapi/Makefile.am
gst-libs/gst/vaapi/gstvaapidisplay.c
gst-libs/gst/vaapi/gstvaapiimage.c
gst-libs/gst/vaapi/gstvaapisurface.c
gst-libs/gst/vaapi/gstvaapisurfacepool.c
gst-libs/gst/vaapi/video-format.c
gst-libs/gst/vaapi/video-format.h
gst/vaapi/gstvaapidownload.c
gst/vaapi/gstvaapiuploader.c
tests/image.c
tests/test-display.c

index 827067c..5c68755 100644 (file)
@@ -1,15 +1,15 @@
 <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>
index f4e771e..a9e61d8 100644 (file)
@@ -227,7 +227,7 @@ libgstvaapi_@GST_API_VERSION@_la_LIBADD =   \
 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 = \
index a92e304..05833c8 100644 (file)
@@ -199,7 +199,7 @@ append_formats(GArray *formats, const VAImageFormat *va_formats,
         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));
@@ -238,14 +238,14 @@ compare_yuv_formats(gconstpointer a, gconstpointer b)
     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 */
@@ -255,14 +255,14 @@ compare_rgb_formats(gconstpointer a, gconstpointer b)
     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 */
@@ -377,7 +377,7 @@ get_format_caps(GArray *formats)
 
     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);
     }
index 9c39ee5..776439d 100644 (file)
@@ -164,7 +164,7 @@ _gst_vaapi_image_create(GstVaapiImage *image, GstVideoFormat format)
     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;
 
@@ -218,7 +218,7 @@ gst_vaapi_image_create(GstVaapiImage *image, GstVideoFormat format,
         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;
@@ -397,7 +397,7 @@ _gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
     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;
 
@@ -425,7 +425,7 @@ _gst_vaapi_image_set_image(GstVaapiImage *image, const VAImage *va_image)
             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]);
index 0ffbc9e..9c681a8 100644 (file)
@@ -145,11 +145,11 @@ gst_vaapi_surface_create_with_format(GstVaapiSurface *surface,
     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;
 
index a5dbbe0..f185f00 100644 (file)
@@ -60,7 +60,7 @@ surface_pool_init(GstVaapiSurfacePool *pool, const GstVideoInfo *vip)
     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;
index b5a3c85..9edd983 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  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
@@ -22,7 +22,7 @@
 
 /**
  * SECTION:videoformat
- * @short_description: Video format abstraction
+ * @short_description: Video format helpers for VA-API
  */
 
 #include "sysdeps.h"
@@ -64,7 +64,7 @@ struct _GstVideoFormatMap {
       { 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),
@@ -132,7 +132,7 @@ get_map(GstVideoFormat format)
 {
     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;
     }
@@ -140,43 +140,39 @@ get_map(GstVideoFormat format)
 }
 
 /**
- * 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
@@ -186,7 +182,7 @@ gst_video_format_is_yuv(GstVideoFormat format)
  * 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;
 
@@ -196,11 +192,11 @@ gst_video_format_from_caps(GstCaps *caps)
     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
@@ -210,7 +206,7 @@ gst_video_format_from_caps(GstCaps *caps)
  * 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");
@@ -248,7 +244,7 @@ gst_video_format_from_structure(GstStructure *structure)
     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])))
@@ -259,7 +255,7 @@ gst_video_format_from_structure(GstStructure *structure)
 }
 
 /**
- * gst_video_format_to_caps:
+ * gst_vaapi_video_format_to_caps:
  * @format: a #GstVideoFormat
  *
  * Converts a #GstVideoFormat into the corresponding #GstCaps. If
@@ -268,7 +264,7 @@ gst_video_format_from_structure(GstStructure *structure)
  * 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);
 
@@ -276,7 +272,7 @@ gst_video_format_to_caps(GstVideoFormat 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.
@@ -286,11 +282,11 @@ gst_video_format_to_caps(GstVideoFormat format)
  * 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;
     }
@@ -298,7 +294,7 @@ gst_video_format_from_va_format(const VAImageFormat *va_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
@@ -308,7 +304,7 @@ gst_video_format_from_va_format(const VAImageFormat *va_format)
  * 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);
 
@@ -316,7 +312,7 @@ gst_video_format_to_va_format(GstVideoFormat format)
 }
 
 /**
- * gst_video_format_get_chroma_type:
+ * gst_vaapi_video_format_get_chroma_type:
  * @format: a #GstVideoFormat
  *
  * Converts a #GstVideoFormat into the corresponding #GstVaapiChromaType
@@ -326,7 +322,7 @@ gst_video_format_to_va_format(GstVideoFormat format)
  *   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);
 
@@ -334,7 +330,7 @@ gst_video_format_get_chroma_type(GstVideoFormat 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
@@ -343,9 +339,9 @@ gst_video_format_get_chroma_type(GstVideoFormat format)
  * 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;
 }
index a1dc9f6..eb7ec1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  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
 
index 18ec054..ccdfe9c 100644 (file)
@@ -334,7 +334,7 @@ gst_vaapidownload_update_src_caps(GstVaapiDownload *download, GstBuffer *buffer)
         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));
index 234674b..dc8f7a5 100755 (executable)
@@ -138,7 +138,7 @@ ensure_allowed_caps(GstVaapiUploader *uploader)
         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);
@@ -224,7 +224,7 @@ ensure_surface_pool(GstVaapiUploader *uploader, GstCaps *caps,
     /* 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);
index d412a17..305322b 100644 (file)
@@ -302,7 +302,7 @@ image_draw_rectangle(
         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)
index 263fa35..07842a2 100644 (file)
@@ -133,15 +133,15 @@ print_format_caps(GstCaps *caps, const gchar *name)
 
         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);