gst_plugins_base/tests/check/libs/video.c
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer unit test for video
       
     2  *
       
     3  * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
       
     4  * Copyright (C) <2006> Jan Schmidt <thaytan@mad.scientist.com>
       
     5  * Copyright (C) <2008> Tim-Philipp Müller <tim centricular net>
       
     6  *
       
     7  * This library is free software; you can redistribute it and/or
       
     8  * modify it under the terms of the GNU Library General Public
       
     9  * License as published by the Free Software Foundation; either
       
    10  * version 2 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This library is distributed in the hope that it will be useful,
       
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15  * Library General Public License for more details.
       
    16  *
       
    17  * You should have received a copy of the GNU Library General Public
       
    18  * License along with this library; if not, write to the
       
    19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    20  * Boston, MA 02111-1307, USA.
       
    21  */
       
    22 
       
    23 #ifdef HAVE_CONFIG_H
       
    24 #include "config.h"
       
    25 #endif
       
    26 
       
    27 #include <unistd.h>
       
    28 
       
    29 #include <gst/check/gstcheck.h>
       
    30 
       
    31 #include <gst/video/video.h>
       
    32 #include <string.h>
       
    33 
       
    34 /* These are from the current/old videotestsrc; we check our new public API
       
    35  * in libgstvideo against the old one to make sure the sizes and offsets
       
    36  * end up the same */
       
    37 
       
    38 typedef struct paintinfo_struct paintinfo;
       
    39 struct paintinfo_struct
       
    40 {
       
    41   unsigned char *dest;          /* pointer to first byte of video data */
       
    42   unsigned char *yp, *up, *vp;  /* pointers to first byte of each component
       
    43                                  * for both packed/planar YUV and RGB */
       
    44   unsigned char *ap;            /* pointer to first byte of alpha component */
       
    45   unsigned char *endptr;        /* pointer to byte beyond last video data */
       
    46   int ystride;
       
    47   int ustride;
       
    48   int vstride;
       
    49   int width;
       
    50   int height;
       
    51 };
       
    52 
       
    53 struct fourcc_list_struct
       
    54 {
       
    55   char *fourcc;
       
    56   char *name;
       
    57   int bitspp;
       
    58   void (*paint_setup) (paintinfo * p, unsigned char *dest);
       
    59 };
       
    60 
       
    61 static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
       
    62 static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
       
    63 static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest);
       
    64 static void paint_setup_UYVY (paintinfo * p, unsigned char *dest);
       
    65 static void paint_setup_YVYU (paintinfo * p, unsigned char *dest);
       
    66 static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
       
    67 static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
       
    68 static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
       
    69 static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
       
    70 static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
       
    71 
       
    72 #if 0
       
    73 static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest);
       
    74 static void paint_setup_IMC2 (paintinfo * p, unsigned char *dest);
       
    75 static void paint_setup_IMC3 (paintinfo * p, unsigned char *dest);
       
    76 static void paint_setup_IMC4 (paintinfo * p, unsigned char *dest);
       
    77 #endif
       
    78 static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
       
    79 static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
       
    80 
       
    81 int fourcc_get_size (struct fourcc_list_struct *fourcc, int w, int h);
       
    82 
       
    83 struct fourcc_list_struct fourcc_list[] = {
       
    84 /* packed */
       
    85   {"YUY2", "YUY2", 16, paint_setup_YUY2},
       
    86   {"UYVY", "UYVY", 16, paint_setup_UYVY},
       
    87   {"Y422", "Y422", 16, paint_setup_UYVY},
       
    88   {"UYNV", "UYNV", 16, paint_setup_UYVY},       /* FIXME: UYNV? */
       
    89   {"YVYU", "YVYU", 16, paint_setup_YVYU},
       
    90   {"AYUV", "AYUV", 32, paint_setup_AYUV},
       
    91 
       
    92   /* interlaced */
       
    93   /*{   "IUYV", "IUY2", 16, paint_setup_YVYU }, */
       
    94 
       
    95   /* inverted */
       
    96   /*{   "cyuv", "cyuv", 16, paint_setup_YVYU }, */
       
    97 
       
    98   /*{   "Y41P", "Y41P", 12, paint_setup_YVYU }, */
       
    99 
       
   100   /* interlaced */
       
   101   /*{   "IY41", "IY41", 12, paint_setup_YVYU }, */
       
   102 
       
   103   /*{   "Y211", "Y211", 8, paint_setup_YVYU }, */
       
   104 
       
   105   /*{   "Y41T", "Y41T", 12, paint_setup_YVYU }, */
       
   106   /*{   "Y42P", "Y42P", 16, paint_setup_YVYU }, */
       
   107   /*{   "CLJR", "CLJR", 8, paint_setup_YVYU }, */
       
   108   /*{   "IYU1", "IYU1", 12, paint_setup_YVYU }, */
       
   109   {"IYU2", "IYU2", 24, paint_setup_IYU2},
       
   110 
       
   111 /* planar */
       
   112   /* YVU9 */
       
   113   {"YVU9", "YVU9", 9, paint_setup_YVU9},
       
   114   /* YUV9 */
       
   115   {"YUV9", "YUV9", 9, paint_setup_YUV9},
       
   116   /* IF09 */
       
   117   /* YV12 */
       
   118   {"YV12", "YV12", 12, paint_setup_YV12},
       
   119   /* I420 */
       
   120   {"I420", "I420", 12, paint_setup_I420},
       
   121   /* NV12 */
       
   122   /* NV21 */
       
   123 #if 0
       
   124   /* IMC1 */
       
   125   {"IMC1", "IMC1", 16, paint_setup_IMC1},
       
   126   /* IMC2 */
       
   127   {"IMC2", "IMC2", 12, paint_setup_IMC2},
       
   128   /* IMC3 */
       
   129   {"IMC3", "IMC3", 16, paint_setup_IMC3},
       
   130   /* IMC4 */
       
   131   {"IMC4", "IMC4", 12, paint_setup_IMC4},
       
   132 #endif
       
   133   /* CLPL */
       
   134   /* Y41B */
       
   135   {"Y41B", "Y41B", 12, paint_setup_Y41B},
       
   136   /* Y42B */
       
   137   {"Y42B", "Y42B", 16, paint_setup_Y42B},
       
   138   /* Y800 grayscale */
       
   139   {"Y800", "Y800", 8, paint_setup_Y800}
       
   140 };
       
   141 
       
   142 /* returns the size in bytes for one video frame of the given dimensions
       
   143  * given the fourcc */
       
   144 int
       
   145 fourcc_get_size (struct fourcc_list_struct *fourcc, int w, int h)
       
   146 {
       
   147   paintinfo pi = { NULL, };
       
   148   paintinfo *p = &pi;
       
   149 
       
   150   p->width = w;
       
   151   p->height = h;
       
   152 
       
   153   fourcc->paint_setup (p, NULL);
       
   154 
       
   155   return (unsigned long) p->endptr;
       
   156 }
       
   157 
       
   158 static void
       
   159 paint_setup_I420 (paintinfo * p, unsigned char *dest)
       
   160 {
       
   161   p->yp = dest;
       
   162   p->ystride = GST_ROUND_UP_4 (p->width);
       
   163   p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
       
   164   p->ustride = GST_ROUND_UP_8 (p->width) / 2;
       
   165   p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
       
   166   p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
       
   167   p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
       
   168 }
       
   169 
       
   170 static void
       
   171 paint_setup_YV12 (paintinfo * p, unsigned char *dest)
       
   172 {
       
   173   p->yp = dest;
       
   174   p->ystride = GST_ROUND_UP_4 (p->width);
       
   175   p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
       
   176   p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
       
   177   p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
       
   178   p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
       
   179   p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
       
   180 }
       
   181 
       
   182 static void
       
   183 paint_setup_AYUV (paintinfo * p, unsigned char *dest)
       
   184 {
       
   185   p->ap = dest;
       
   186   p->yp = dest + 1;
       
   187   p->up = dest + 2;
       
   188   p->vp = dest + 3;
       
   189   p->ystride = p->width * 4;
       
   190   p->endptr = dest + p->ystride * p->height;
       
   191 }
       
   192 
       
   193 static void
       
   194 paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
       
   195 {
       
   196   p->yp = dest;
       
   197   p->up = dest + 1;
       
   198   p->vp = dest + 3;
       
   199   p->ystride = GST_ROUND_UP_2 (p->width) * 2;
       
   200   p->endptr = dest + p->ystride * p->height;
       
   201 }
       
   202 
       
   203 static void
       
   204 paint_setup_UYVY (paintinfo * p, unsigned char *dest)
       
   205 {
       
   206   p->yp = dest + 1;
       
   207   p->up = dest;
       
   208   p->vp = dest + 2;
       
   209   p->ystride = GST_ROUND_UP_2 (p->width) * 2;
       
   210   p->endptr = dest + p->ystride * p->height;
       
   211 }
       
   212 
       
   213 static void
       
   214 paint_setup_YVYU (paintinfo * p, unsigned char *dest)
       
   215 {
       
   216   p->yp = dest;
       
   217   p->up = dest + 3;
       
   218   p->vp = dest + 1;
       
   219   p->ystride = GST_ROUND_UP_2 (p->width) * 2;
       
   220   p->endptr = dest + p->ystride * p->height;
       
   221 }
       
   222 
       
   223 static void
       
   224 paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
       
   225 {
       
   226   /* untested */
       
   227   p->yp = dest + 1;
       
   228   p->up = dest + 0;
       
   229   p->vp = dest + 2;
       
   230   p->ystride = GST_ROUND_UP_4 (p->width * 3);
       
   231   p->endptr = dest + p->ystride * p->height;
       
   232 }
       
   233 
       
   234 static void
       
   235 paint_setup_Y41B (paintinfo * p, unsigned char *dest)
       
   236 {
       
   237   p->yp = dest;
       
   238   p->ystride = GST_ROUND_UP_4 (p->width);
       
   239   p->up = p->yp + p->ystride * p->height;
       
   240   p->ustride = GST_ROUND_UP_8 (p->width) / 4;
       
   241   p->vp = p->up + p->ustride * p->height;
       
   242   p->vstride = GST_ROUND_UP_8 (p->width) / 4;
       
   243   p->endptr = p->vp + p->vstride * p->height;
       
   244 }
       
   245 
       
   246 static void
       
   247 paint_setup_Y42B (paintinfo * p, unsigned char *dest)
       
   248 {
       
   249   p->yp = dest;
       
   250   p->ystride = GST_ROUND_UP_4 (p->width);
       
   251   p->up = p->yp + p->ystride * p->height;
       
   252   p->ustride = GST_ROUND_UP_8 (p->width) / 2;
       
   253   p->vp = p->up + p->ustride * p->height;
       
   254   p->vstride = GST_ROUND_UP_8 (p->width) / 2;
       
   255   p->endptr = p->vp + p->vstride * p->height;
       
   256 }
       
   257 
       
   258 static void
       
   259 paint_setup_Y800 (paintinfo * p, unsigned char *dest)
       
   260 {
       
   261   /* untested */
       
   262   p->yp = dest;
       
   263   p->ystride = GST_ROUND_UP_4 (p->width);
       
   264   p->endptr = dest + p->ystride * p->height;
       
   265 }
       
   266 
       
   267 #if 0
       
   268 static void
       
   269 paint_setup_IMC1 (paintinfo * p, unsigned char *dest)
       
   270 {
       
   271   p->yp = dest;
       
   272   p->up = dest + p->width * p->height;
       
   273   p->vp = dest + p->width * p->height + p->width * p->height / 2;
       
   274 }
       
   275 
       
   276 static void
       
   277 paint_setup_IMC2 (paintinfo * p, unsigned char *dest)
       
   278 {
       
   279   p->yp = dest;
       
   280   p->vp = dest + p->width * p->height;
       
   281   p->up = dest + p->width * p->height + p->width / 2;
       
   282 }
       
   283 
       
   284 static void
       
   285 paint_setup_IMC3 (paintinfo * p, unsigned char *dest)
       
   286 {
       
   287   p->yp = dest;
       
   288   p->up = dest + p->width * p->height + p->width * p->height / 2;
       
   289   p->vp = dest + p->width * p->height;
       
   290 }
       
   291 
       
   292 static void
       
   293 paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
       
   294 {
       
   295   p->yp = dest;
       
   296   p->vp = dest + p->width * p->height + p->width / 2;
       
   297   p->up = dest + p->width * p->height;
       
   298 }
       
   299 #endif
       
   300 
       
   301 static void
       
   302 paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
       
   303 {
       
   304   int h = GST_ROUND_UP_4 (p->height);
       
   305 
       
   306   p->yp = dest;
       
   307   p->ystride = GST_ROUND_UP_4 (p->width);
       
   308   p->vp = p->yp + p->ystride * GST_ROUND_UP_4 (p->height);
       
   309   p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
       
   310   p->up = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
       
   311   p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
       
   312   p->endptr = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
       
   313 }
       
   314 
       
   315 static void
       
   316 paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
       
   317 {
       
   318   /* untested */
       
   319   int h = GST_ROUND_UP_4 (p->height);
       
   320 
       
   321   p->yp = dest;
       
   322   p->ystride = GST_ROUND_UP_4 (p->width);
       
   323   p->up = p->yp + p->ystride * h;
       
   324   p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
       
   325   p->vp = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
       
   326   p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
       
   327   p->endptr = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
       
   328 }
       
   329 
       
   330 #define gst_video_format_is_packed video_format_is_packed
       
   331 static gboolean
       
   332 video_format_is_packed (GstVideoFormat fmt)
       
   333 {
       
   334   switch (fmt) {
       
   335     case GST_VIDEO_FORMAT_I420:
       
   336     case GST_VIDEO_FORMAT_YV12:
       
   337     case GST_VIDEO_FORMAT_Y41B:
       
   338     case GST_VIDEO_FORMAT_Y42B:
       
   339       return FALSE;
       
   340     case GST_VIDEO_FORMAT_YUY2:
       
   341     case GST_VIDEO_FORMAT_UYVY:
       
   342     case GST_VIDEO_FORMAT_AYUV:
       
   343     case GST_VIDEO_FORMAT_RGBx:
       
   344     case GST_VIDEO_FORMAT_BGRx:
       
   345     case GST_VIDEO_FORMAT_xRGB:
       
   346     case GST_VIDEO_FORMAT_xBGR:
       
   347     case GST_VIDEO_FORMAT_RGBA:
       
   348     case GST_VIDEO_FORMAT_BGRA:
       
   349     case GST_VIDEO_FORMAT_ARGB:
       
   350     case GST_VIDEO_FORMAT_ABGR:
       
   351     case GST_VIDEO_FORMAT_RGB:
       
   352     case GST_VIDEO_FORMAT_BGR:
       
   353       return TRUE;
       
   354     default:
       
   355       g_return_val_if_reached (FALSE);
       
   356   }
       
   357   return FALSE;
       
   358 }
       
   359 
       
   360 GST_START_TEST (test_video_formats)
       
   361 {
       
   362   guint i;
       
   363 
       
   364   for (i = 0; i < G_N_ELEMENTS (fourcc_list); ++i) {
       
   365     GstVideoFormat fmt;
       
   366     const gchar *s;
       
   367     guint32 fourcc;
       
   368     guint w, h;
       
   369 
       
   370     s = fourcc_list[i].fourcc;
       
   371     fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
       
   372     fmt = gst_video_format_from_fourcc (fourcc);
       
   373 
       
   374     if (fmt == GST_VIDEO_FORMAT_UNKNOWN)
       
   375       continue;
       
   376 
       
   377     GST_INFO ("Fourcc %s, packed=%d", fourcc_list[i].fourcc,
       
   378         gst_video_format_is_packed (fmt));
       
   379 
       
   380     fail_unless (gst_video_format_is_yuv (fmt));
       
   381 
       
   382     /* use any non-NULL pointer so we can compare against NULL */
       
   383     {
       
   384       paintinfo paintinfo = { 0, };
       
   385       fourcc_list[i].paint_setup (&paintinfo, (unsigned char *) s);
       
   386       if (paintinfo.ap != NULL) {
       
   387         fail_unless (gst_video_format_has_alpha (fmt));
       
   388       } else {
       
   389         fail_if (gst_video_format_has_alpha (fmt));
       
   390       }
       
   391     }
       
   392 
       
   393     for (w = 1; w <= 65; ++w) {
       
   394       for (h = 1; h <= 65; ++h) {
       
   395         paintinfo paintinfo = { 0, };
       
   396 
       
   397         GST_LOG ("%s, %dx%d", fourcc_list[i].fourcc, w, h);
       
   398 
       
   399         paintinfo.width = w;
       
   400         paintinfo.height = h;
       
   401         fourcc_list[i].paint_setup (&paintinfo, NULL);
       
   402         fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 0, w),
       
   403             paintinfo.ystride);
       
   404         if (!gst_video_format_is_packed (fmt)) {
       
   405           /* planar */
       
   406           fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 1, w),
       
   407               paintinfo.ustride);
       
   408           fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 2, w),
       
   409               paintinfo.vstride);
       
   410           /* check component_width * height against offsets/size somehow? */
       
   411         }
       
   412         fail_unless_equals_int (gst_video_format_get_component_offset (fmt, 0,
       
   413                 w, h), (unsigned long) paintinfo.yp);
       
   414         fail_unless_equals_int (gst_video_format_get_component_offset (fmt, 1,
       
   415                 w, h), (unsigned long) paintinfo.up);
       
   416         fail_unless_equals_int (gst_video_format_get_component_offset (fmt, 2,
       
   417                 w, h), (unsigned long) paintinfo.vp);
       
   418         fail_unless_equals_int (gst_video_format_get_size (fmt, w, h),
       
   419             (unsigned long) paintinfo.endptr);
       
   420       }
       
   421     }
       
   422   }
       
   423 }
       
   424 
       
   425 GST_END_TEST;
       
   426 
       
   427 GST_START_TEST (test_dar_calc)
       
   428 {
       
   429   guint display_ratio_n, display_ratio_d;
       
   430 
       
   431   /* Ensure that various Display Ratio calculations are correctly done */
       
   432   /* video 768x576, par 16/15, display par 16/15 = 4/3 */
       
   433   fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
       
   434           &display_ratio_d, 768, 576, 16, 15, 16, 15));
       
   435   fail_unless (display_ratio_n == 4 && display_ratio_d == 3);
       
   436 
       
   437   /* video 720x480, par 32/27, display par 1/1 = 16/9 */
       
   438   fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
       
   439           &display_ratio_d, 720, 480, 32, 27, 1, 1));
       
   440   fail_unless (display_ratio_n == 16 && display_ratio_d == 9);
       
   441 
       
   442   /* video 360x288, par 533333/500000, display par 16/15 = 
       
   443    * dar 1599999/1600000 */
       
   444   fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
       
   445           &display_ratio_d, 360, 288, 533333, 500000, 16, 15));
       
   446   fail_unless (display_ratio_n == 1599999 && display_ratio_d == 1280000);
       
   447 }
       
   448 
       
   449 GST_END_TEST;
       
   450 
       
   451 GST_START_TEST (test_parse_caps_rgb)
       
   452 {
       
   453   struct
       
   454   {
       
   455     const gchar *tmpl_caps_string;
       
   456     GstVideoFormat fmt;
       
   457   } formats[] = {
       
   458     /* 24 bit */
       
   459     {
       
   460     GST_VIDEO_CAPS_RGB, GST_VIDEO_FORMAT_RGB}, {
       
   461     GST_VIDEO_CAPS_BGR, GST_VIDEO_FORMAT_BGR},
       
   462         /* 32 bit (no alpha) */
       
   463     {
       
   464     GST_VIDEO_CAPS_RGBx, GST_VIDEO_FORMAT_RGBx}, {
       
   465     GST_VIDEO_CAPS_xRGB, GST_VIDEO_FORMAT_xRGB}, {
       
   466     GST_VIDEO_CAPS_BGRx, GST_VIDEO_FORMAT_BGRx}, {
       
   467     GST_VIDEO_CAPS_xBGR, GST_VIDEO_FORMAT_xBGR},
       
   468         /* 32 bit (with alpha) */
       
   469     {
       
   470     GST_VIDEO_CAPS_RGBA, GST_VIDEO_FORMAT_RGBA}, {
       
   471     GST_VIDEO_CAPS_ARGB, GST_VIDEO_FORMAT_ARGB}, {
       
   472     GST_VIDEO_CAPS_BGRA, GST_VIDEO_FORMAT_BGRA}, {
       
   473     GST_VIDEO_CAPS_ABGR, GST_VIDEO_FORMAT_ABGR}
       
   474   };
       
   475   gint i;
       
   476 
       
   477   for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
       
   478     GstVideoFormat fmt = GST_VIDEO_FORMAT_UNKNOWN;
       
   479     GstCaps *caps, *caps2;
       
   480     int w = -1, h = -1;
       
   481 
       
   482     caps = gst_caps_from_string (formats[i].tmpl_caps_string);
       
   483     gst_caps_set_simple (caps, "width", G_TYPE_INT, 2 * i, "height",
       
   484         G_TYPE_INT, i, "framerate", GST_TYPE_FRACTION, 15, 1,
       
   485         "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
       
   486     g_assert (gst_caps_is_fixed (caps));
       
   487 
       
   488     GST_DEBUG ("testing caps: %" GST_PTR_FORMAT, caps);
       
   489 
       
   490     fail_unless (gst_video_format_parse_caps (caps, &fmt, &w, &h));
       
   491     fail_unless_equals_int (fmt, formats[i].fmt);
       
   492     fail_unless_equals_int (w, 2 * i);
       
   493     fail_unless_equals_int (h, i);
       
   494 
       
   495     /* make sure they're serialised back correctly */
       
   496     caps2 = gst_video_format_new_caps (fmt, w, h, 15, 1, 1, 1);
       
   497     fail_unless (caps != NULL);
       
   498     fail_unless (gst_caps_is_equal (caps, caps2));
       
   499 
       
   500     gst_caps_unref (caps);
       
   501     gst_caps_unref (caps2);
       
   502   }
       
   503 }
       
   504 
       
   505 GST_END_TEST;
       
   506 
       
   507 static Suite *
       
   508 video_suite (void)
       
   509 {
       
   510   Suite *s = suite_create ("video support library");
       
   511   TCase *tc_chain = tcase_create ("general");
       
   512 
       
   513   suite_add_tcase (s, tc_chain);
       
   514   tcase_add_test (tc_chain, test_video_formats);
       
   515   tcase_add_test (tc_chain, test_dar_calc);
       
   516   tcase_add_test (tc_chain, test_parse_caps_rgb);
       
   517 
       
   518   return s;
       
   519 }
       
   520 
       
   521 GST_CHECK_MAIN (video);