1 /* GStreamer 2 * Copyright (C) <2002> David A. Schleef <ds@schleef.org> 3 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GST_VIDEO_TEST_SRC_H__ 22 #define __GST_VIDEO_TEST_SRC_H__ 23 24 #include <gst/gst.h> 25 #include <gst/base/gstpushsrc.h> 26 27 #include <gst/video/gstvideometa.h> 28 #include <gst/video/gstvideopool.h> 29 30 G_BEGIN_DECLS 31 32 #define GST_TYPE_VIDEO_TEST_SRC \ 33 (gst_video_test_src_get_type()) 34 #define GST_VIDEO_TEST_SRC(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_TEST_SRC,GstVideoTestSrc)) 36 #define GST_VIDEO_TEST_SRC_CLASS(klass) \ 37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_TEST_SRC,GstVideoTestSrcClass)) 38 #define GST_IS_VIDEO_TEST_SRC(obj) \ 39 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_TEST_SRC)) 40 #define GST_IS_VIDEO_TEST_SRC_CLASS(klass) \ 41 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_TEST_SRC)) 42 43 /** 44 * GstVideoTestSrcPattern: 45 * @GST_VIDEO_TEST_SRC_SMPTE: A standard SMPTE test pattern 46 * @GST_VIDEO_TEST_SRC_SNOW: Random noise 47 * @GST_VIDEO_TEST_SRC_BLACK: A black image 48 * @GST_VIDEO_TEST_SRC_WHITE: A white image 49 * @GST_VIDEO_TEST_SRC_RED: A red image 50 * @GST_VIDEO_TEST_SRC_GREEN: A green image 51 * @GST_VIDEO_TEST_SRC_BLUE: A blue image 52 * @GST_VIDEO_TEST_SRC_CHECKERS1: Checkers pattern (1px) 53 * @GST_VIDEO_TEST_SRC_CHECKERS2: Checkers pattern (2px) 54 * @GST_VIDEO_TEST_SRC_CHECKERS4: Checkers pattern (4px) 55 * @GST_VIDEO_TEST_SRC_CHECKERS8: Checkers pattern (8px) 56 * @GST_VIDEO_TEST_SRC_CIRCULAR: Circular pattern 57 * @GST_VIDEO_TEST_SRC_BLINK: Alternate between black and white 58 * @GST_VIDEO_TEST_SRC_SMPTE75: SMPTE test pattern (75% color bars) 59 * @GST_VIDEO_TEST_SRC_ZONE_PLATE: Zone plate 60 * @GST_VIDEO_TEST_SRC_GAMUT: Gamut checking pattern 61 * @GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE: Chroma zone plate 62 * @GST_VIDEO_TEST_SRC_BALL: Moving ball 63 * @GST_VIDEO_TEST_SRC_SMPTE100: SMPTE test pattern (100% color bars) 64 * @GST_VIDEO_TEST_SRC_SOLID: A solid color, defined by the 65 * #GstVideoTestSrc:foreground-color property 66 * @GST_VIDEO_TEST_SRC_BAR: Bar with foreground color 67 * @GST_VIDEO_TEST_SRC_PINWHEEL: Pinwheel 68 * @GST_VIDEO_TEST_SRC_SPOKES: Spokes 69 * @GST_VIDEO_TEST_SRC_GRADIENT: Gradient 70 * @GST_VIDEO_TEST_SRC_COLORS: All colors 71 * 72 * The test pattern to produce. 73 * 74 * The Gamut pattern creates a checkerboard pattern of colors at the 75 * edge of the YCbCr gamut and nearby colors that are out of gamut. 76 * The pattern is divided into 4 regions: black, white, red, and blue. 77 * After conversion to RGB, the out-of-gamut colors should be converted 78 * to the same value as their in-gamut neighbors. If the checkerboard 79 * pattern is still visible after conversion, this indicates a faulty 80 * conversion. Image manipulation, such as adjusting contrast or 81 * brightness, can also cause the pattern to be visible. 82 * 83 * The Zone Plate pattern is based on BBC R&D Report 1978/23, and can 84 * be used to test spatial frequency response of a system. This 85 * pattern generator is controlled by the xoffset and yoffset parameters 86 * and also by all the parameters starting with 'k'. The default 87 * parameters produce a grey pattern. Try 'videotestsrc 88 * pattern=zone-plate kx2=20 ky2=20 kt=1' to produce something 89 * interesting. 90 */ 91 typedef enum { 92 GST_VIDEO_TEST_SRC_SMPTE, 93 GST_VIDEO_TEST_SRC_SNOW, 94 GST_VIDEO_TEST_SRC_BLACK, 95 GST_VIDEO_TEST_SRC_WHITE, 96 GST_VIDEO_TEST_SRC_RED, 97 GST_VIDEO_TEST_SRC_GREEN, 98 GST_VIDEO_TEST_SRC_BLUE, 99 GST_VIDEO_TEST_SRC_CHECKERS1, 100 GST_VIDEO_TEST_SRC_CHECKERS2, 101 GST_VIDEO_TEST_SRC_CHECKERS4, 102 GST_VIDEO_TEST_SRC_CHECKERS8, 103 GST_VIDEO_TEST_SRC_CIRCULAR, 104 GST_VIDEO_TEST_SRC_BLINK, 105 GST_VIDEO_TEST_SRC_SMPTE75, 106 GST_VIDEO_TEST_SRC_ZONE_PLATE, 107 GST_VIDEO_TEST_SRC_GAMUT, 108 GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE, 109 GST_VIDEO_TEST_SRC_SOLID, 110 GST_VIDEO_TEST_SRC_BALL, 111 GST_VIDEO_TEST_SRC_SMPTE100, 112 GST_VIDEO_TEST_SRC_BAR, 113 GST_VIDEO_TEST_SRC_PINWHEEL, 114 GST_VIDEO_TEST_SRC_SPOKES, 115 GST_VIDEO_TEST_SRC_GRADIENT, 116 GST_VIDEO_TEST_SRC_COLORS 117 } GstVideoTestSrcPattern; 118 119 typedef enum { 120 GST_VIDEO_TEST_SRC_FRAMES, 121 GST_VIDEO_TEST_SRC_WALL_TIME, 122 GST_VIDEO_TEST_SRC_RUNNING_TIME 123 } GstVideoTestSrcAnimationMode; 124 125 126 typedef enum { 127 GST_VIDEO_TEST_SRC_WAVY, 128 GST_VIDEO_TEST_SRC_SWEEP, 129 GST_VIDEO_TEST_SRC_HSWEEP 130 } GstVideoTestSrcMotionType; 131 132 typedef struct _GstVideoTestSrc GstVideoTestSrc; 133 typedef struct _GstVideoTestSrcClass GstVideoTestSrcClass; 134 135 /** 136 * GstVideoTestSrc: 137 * 138 * Opaque data structure. 139 */ 140 struct _GstVideoTestSrc { 141 GstPushSrc element; 142 143 /*< private >*/ 144 145 /* type of output */ 146 GstVideoTestSrcPattern pattern_type; 147 148 /* video state */ 149 GstVideoInfo info; /* protected by the object or stream lock */ 150 GstVideoChromaResample *subsample; 151 gboolean bayer; 152 gint x_invert; 153 gint y_invert; 154 155 /* private */ 156 /* FIXME 2.0: Change type to GstClockTime */ 157 gint64 timestamp_offset; /* base offset */ 158 159 /* running time and frames for current caps */ 160 GstClockTime running_time; /* total running time */ 161 gint64 n_frames; /* total frames sent */ 162 gboolean reverse; 163 164 /* previous caps running time and frames */ 165 GstClockTime accum_rtime; /* accumulated running_time */ 166 gint64 accum_frames; /* accumulated frames */ 167 168 /* zoneplate */ 169 gint k0; 170 gint kx; 171 gint ky; 172 gint kt; 173 gint kxt; 174 gint kyt; 175 gint kxy; 176 gint kx2; 177 gint ky2; 178 gint kt2; 179 gint xoffset; 180 gint yoffset; 181 182 /* solid color */ 183 guint foreground_color; 184 guint background_color; 185 186 /* moving color bars */ 187 gint horizontal_offset; 188 gint horizontal_speed; 189 190 /* smpte & snow */ 191 guint random_state; 192 193 /* Ball motion */ 194 GstVideoTestSrcAnimationMode animation_mode; 195 GstVideoTestSrcMotionType motion_type; 196 gboolean flip; 197 198 void (*make_image) (GstVideoTestSrc *v, GstClockTime pts, GstVideoFrame *frame); 199 200 /* temporary AYUV/ARGB scanline */ 201 guint8 *tmpline_u8; 202 guint8 *tmpline; 203 guint8 *tmpline2; 204 guint16 *tmpline_u16; 205 206 guint n_lines; 207 gint offset; 208 gpointer *lines; 209 }; 210 211 struct _GstVideoTestSrcClass { 212 GstPushSrcClass parent_class; 213 }; 214 215 GType gst_video_test_src_get_type (void); 216 217 G_END_DECLS 218 219 #endif /* __GST_VIDEO_TEST_SRC_H__ */ 220