static GstFlowReturn gst_video_test_src_fill (GstPushSrc * psrc,
GstBuffer * buffer);
static gboolean gst_video_test_src_start (GstBaseSrc * basesrc);
+static gboolean gst_video_test_src_stop (GstBaseSrc * basesrc);
#define GST_TYPE_VIDEO_TEST_SRC_PATTERN (gst_video_test_src_pattern_get_type ())
static GType
gstbasesrc_class->query = gst_video_test_src_query;
gstbasesrc_class->get_times = gst_video_test_src_get_times;
gstbasesrc_class->start = gst_video_test_src_start;
+ gstbasesrc_class->stop = gst_video_test_src_stop;
gstbasesrc_class->setup_allocation = gst_video_test_src_setup_allocation;
gstpushsrc_class->fill = gst_video_test_src_fill;
}
}
+static GstVideoTestSrcColorSpec
+to_color_spec (const gchar * csp)
+{
+ if (csp) {
+ if (strcmp (csp, "sdtv") == 0) {
+ return GST_VIDEO_TEST_SRC_BT601;
+ } else if (strcmp (csp, "hdtv") == 0) {
+ return GST_VIDEO_TEST_SRC_BT709;
+ } else {
+ GST_DEBUG ("unknown color-matrix");
+ return GST_VIDEO_TEST_SRC_UNKNOWN;
+ }
+ } else {
+ return GST_VIDEO_TEST_SRC_BT601;
+ }
+}
+
/* threadsafe because this gets called as the plugin is loaded */
static GstCaps *
gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
static gboolean
gst_video_test_src_parse_caps (const GstCaps * caps,
- gint * width, gint * height, gint * rate_numerator, gint * rate_denominator,
- struct format_list_struct **format, GstVideoTestSrcColorSpec * color_spec)
+ gint * width, gint * height, gint * fps_n, gint * fps_d,
+ const gchar ** color_matrix)
{
const GstStructure *structure;
GstPadLinkReturn ret;
const GValue *framerate;
- const char *csp;
GST_DEBUG ("parsing caps");
- if (gst_caps_get_size (caps) < 1)
- return FALSE;
-
structure = gst_caps_get_structure (caps, 0);
- if (!(*format = paintinfo_find_by_structure (structure)))
- goto unknown_format;
-
ret = gst_structure_get_int (structure, "width", width);
ret &= gst_structure_get_int (structure, "height", height);
framerate = gst_structure_get_value (structure, "framerate");
if (framerate) {
- *rate_numerator = gst_value_get_fraction_numerator (framerate);
- *rate_denominator = gst_value_get_fraction_denominator (framerate);
+ *fps_n = gst_value_get_fraction_numerator (framerate);
+ *fps_d = gst_value_get_fraction_denominator (framerate);
} else
goto no_framerate;
- csp = gst_structure_get_string (structure, "color-matrix");
- if (csp) {
- if (strcmp (csp, "sdtv") == 0) {
- *color_spec = GST_VIDEO_TEST_SRC_BT601;
- } else if (strcmp (csp, "hdtv") == 0) {
- *color_spec = GST_VIDEO_TEST_SRC_BT709;
- } else {
- GST_DEBUG ("unknown color-matrix");
- return FALSE;
- }
- } else {
- *color_spec = GST_VIDEO_TEST_SRC_BT601;
- }
+ *color_matrix = gst_structure_get_string (structure, "color-matrix");
return ret;
/* ERRORS */
-unknown_format:
- {
- GST_DEBUG ("videotestsrc format not found");
- return FALSE;
- }
no_framerate:
{
GST_DEBUG ("videotestsrc no framerate given");
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
&alignment, &pool);
-
/* adjust size */
- size = MAX (size, videotestsrc->size);
+ size = MAX (size, videotestsrc->info.size);
+
+ if (pool) {
+ GstStructure *config;
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_add_meta (config, GST_META_API_VIDEO);
+ gst_buffer_pool_set_config (pool, config);
+ }
gst_query_set_allocation_params (query, size, min, max, prefix,
alignment, pool);
static gboolean
gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
{
- gboolean res;
- gint width, height, rate_denominator, rate_numerator;
struct format_list_struct *format;
+ const GstStructure *structure;
GstVideoTestSrc *videotestsrc;
- GstVideoTestSrcColorSpec color_spec;
+ GstVideoInfo info;
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
- res = gst_video_test_src_parse_caps (caps, &width, &height,
- &rate_numerator, &rate_denominator, &format, &color_spec);
- if (!res)
- goto parse_failed;
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (gst_structure_has_name (structure, "video/x-raw")) {
+ /* we can use the parsing code */
+ if (!gst_video_info_from_caps (&info, caps))
+ goto parse_failed;
+
+ } else if (gst_structure_has_name (structure, "video/x-raw-bayer")) {
+ if (!gst_video_test_src_parse_caps (caps, &info.width, &info.height,
+ &info.fps_n, &info.fps_d, &info.color_matrix))
+ goto parse_failed;
+
+ info.size =
+ gst_video_test_src_get_size (videotestsrc, info.width, info.height);
+ }
+
+ if (!(format = paintinfo_find_by_structure (structure)))
+ goto unknown_format;
/* looks ok here */
+ videotestsrc->color_spec = to_color_spec (info.color_matrix);
videotestsrc->format = format;
- videotestsrc->width = width;
- videotestsrc->height = height;
- videotestsrc->rate_numerator = rate_numerator;
- videotestsrc->rate_denominator = rate_denominator;
- videotestsrc->bpp = videotestsrc->format->bitspp;
- videotestsrc->color_spec = color_spec;
- videotestsrc->size =
- gst_video_test_src_get_size (videotestsrc, width, height);
+ videotestsrc->info = info;
GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
- videotestsrc->width, videotestsrc->height,
- videotestsrc->rate_numerator, videotestsrc->rate_denominator);
+ info.width, info.height, info.fps_n, info.fps_d);
- return res;
+ g_free (videotestsrc->tmpline);
+ g_free (videotestsrc->tmpline2);
+ g_free (videotestsrc->tmpline_u8);
+ videotestsrc->tmpline_u8 = g_malloc (info.width + 8);
+ videotestsrc->tmpline = g_malloc ((info.width + 8) * 4);
+ videotestsrc->tmpline2 = g_malloc ((info.width + 8) * 4);
+
+ return TRUE;
/* ERRORS */
parse_failed:
GST_DEBUG_OBJECT (bsrc, "failed to parse caps");
return FALSE;
}
+unknown_format:
+ {
+ GST_DEBUG ("videotestsrc format not found");
+ return FALSE;
+ }
}
static gboolean
gint64 src_val, dest_val;
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (src_fmt == dest_fmt) {
- dest_val = src_val;
- goto done;
- }
-
- switch (src_fmt) {
- case GST_FORMAT_DEFAULT:
- switch (dest_fmt) {
- case GST_FORMAT_TIME:
- /* frames to time */
- if (src->rate_numerator) {
- dest_val = gst_util_uint64_scale (src_val,
- src->rate_denominator * GST_SECOND, src->rate_numerator);
- } else {
- dest_val = 0;
- }
- break;
- default:
- goto error;
- }
- break;
- case GST_FORMAT_TIME:
- switch (dest_fmt) {
- case GST_FORMAT_DEFAULT:
- /* time to frames */
- if (src->rate_numerator) {
- dest_val = gst_util_uint64_scale (src_val,
- src->rate_numerator, src->rate_denominator * GST_SECOND);
- } else {
- dest_val = 0;
- }
- break;
- default:
- goto error;
- }
- break;
- default:
- goto error;
- }
- done:
+ res =
+ gst_video_info_convert (&src->info, src_fmt, src_val, dest_fmt,
+ &dest_val);
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- res = TRUE;
break;
}
default:
res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+ break;
}
return res;
-
- /* ERROR */
-error:
- {
- GST_DEBUG_OBJECT (src, "query failed");
- return FALSE;
- }
}
static void
position = segment->position;
/* now move to the position indicated */
- if (src->rate_numerator) {
+ if (src->info.fps_n) {
src->n_frames = gst_util_uint64_scale (position,
- src->rate_numerator, src->rate_denominator * GST_SECOND);
+ src->info.fps_n, src->info.fps_d * GST_SECOND);
} else {
src->n_frames = 0;
}
- if (src->rate_numerator) {
+ if (src->info.fps_n) {
src->running_time = gst_util_uint64_scale (src->n_frames,
- src->rate_denominator * GST_SECOND, src->rate_numerator);
+ src->info.fps_d * GST_SECOND, src->info.fps_n);
} else {
/* FIXME : Not sure what to set here */
src->running_time = 0;
gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
{
GstVideoTestSrc *src;
- gsize size;
GstClockTime next_time;
- guint8 *data;
+ GstVideoFrame frame;
src = GST_VIDEO_TEST_SRC (psrc);
goto not_negotiated;
/* 0 framerate and we are at the second frame, eos */
- if (G_UNLIKELY (src->rate_numerator == 0 && src->n_frames == 1))
+ if (G_UNLIKELY (src->info.fps_n == 0 && src->n_frames == 1))
goto eos;
GST_LOG_OBJECT (src,
"creating buffer from pool for frame %d", (gint) src->n_frames);
- data = gst_buffer_map (buffer, &size, NULL, GST_MAP_WRITE);
- memset (data, 0, size);
- src->tmpline_u8 = g_malloc (src->width + 8);
- src->tmpline = g_malloc ((src->width + 8) * 4);
- src->tmpline2 = g_malloc ((src->width + 8) * 4);
+ if (!gst_video_frame_map (&frame, &src->info, buffer, GST_MAP_WRITE))
+ goto invalid_frame;
- src->make_image (src, (void *) data, src->width, src->height);
- gst_buffer_unmap (buffer, data, size);
+ src->make_image (src, &frame);
- g_free (src->tmpline);
- g_free (src->tmpline2);
- g_free (src->tmpline_u8);
+ gst_video_frame_unmap (&frame);
GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
GST_BUFFER_OFFSET (buffer) = src->n_frames;
src->n_frames++;
GST_BUFFER_OFFSET_END (buffer) = src->n_frames;
- if (src->rate_numerator) {
+ if (src->info.fps_n) {
next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
- src->rate_denominator, src->rate_numerator);
+ src->info.fps_d, src->info.fps_n);
GST_BUFFER_DURATION (buffer) = next_time - src->running_time;
} else {
next_time = src->timestamp_offset;
GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
return GST_FLOW_UNEXPECTED;
}
+invalid_frame:
+ {
+ GST_DEBUG_OBJECT (src, "invalid frame");
+ return GST_FLOW_OK;
+ }
}
static gboolean
}
static gboolean
+gst_video_test_src_stop (GstBaseSrc * basesrc)
+{
+ GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (basesrc);
+
+ g_free (src->tmpline);
+ src->tmpline = NULL;
+ g_free (src->tmpline2);
+ src->tmpline2 = NULL;
+ g_free (src->tmpline_u8);
+ src->tmpline_u8 = NULL;
+
+ return TRUE;
+}
+
+static gboolean
plugin_init (GstPlugin * plugin)
{
gst_videotestsrc_orc_init ();
};
-static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVY (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVYU (paintinfo * p, unsigned char *dest);
+static void paint_setup_I420 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YV12 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YUY2 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_UYVY (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YVYU (paintinfo * p, GstVideoFrame * frame);
#ifdef disabled
-static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
+static void paint_setup_IYU2 (paintinfo * p, GstVideoFrame * frame);
#endif
-static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y444 (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
-static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
-static void paint_setup_v308 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV21 (paintinfo * p, unsigned char *dest);
+static void paint_setup_Y41B (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y42B (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y444 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_Y800 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_AYUV (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_v308 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_NV12 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_NV21 (paintinfo * p, GstVideoFrame * frame);
#ifdef disabled
-static void paint_setup_v410 (paintinfo * p, unsigned char *dest);
+static void paint_setup_v410 (paintinfo * p, GstVideoFrame * frame);
#endif
-static void paint_setup_v216 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v210 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVP (paintinfo * p, unsigned char *dest);
-static void paint_setup_AY64 (paintinfo * p, unsigned char *dest);
-
-static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGR888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB565 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ARGB64 (paintinfo * p, unsigned char *dest);
-
-static void paint_setup_bayer_bggr (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_rggb (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_gbrg (paintinfo * p, unsigned char *dest);
-static void paint_setup_bayer_grbg (paintinfo * p, unsigned char *dest);
+static void paint_setup_v216 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_v210 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_UYVP (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_AY64 (paintinfo * p, GstVideoFrame * frame);
+
+static void paint_setup_YUV9 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_YVU9 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ARGB8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ABGR8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGBA8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGRA8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xRGB8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xBGR8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGBx8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGRx8888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGB888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_BGR888 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_RGB565 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_xRGB1555 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_ARGB64 (paintinfo * p, GstVideoFrame * frame);
+
+static void paint_setup_bayer_bggr (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_rggb (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_gbrg (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_bayer_grbg (paintinfo * p, GstVideoFrame * frame);
static void convert_hline_I420 (paintinfo * p, int y);
static void convert_hline_NV12 (paintinfo * p, int y);
static void convert_hline_bayer (paintinfo * p, int y);
-static void paint_setup_GRAY8 (paintinfo * p, unsigned char *dest);
-static void paint_setup_GRAY16 (paintinfo * p, unsigned char *dest);
+static void paint_setup_GRAY8 (paintinfo * p, GstVideoFrame * frame);
+static void paint_setup_GRAY16 (paintinfo * p, GstVideoFrame * frame);
static void convert_hline_GRAY8 (paintinfo * p, int y);
static void convert_hline_GRAY16 (paintinfo * p, int y);
format->paint_setup (p, NULL);
- return (unsigned long) p->endptr;
+ return p->size;
}
#define SCALEBITS 10
}
void
-gst_video_test_src_smpte (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
+gst_video_test_src_smpte (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int y1, y2;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
- videotestsrc_setup_paintinfo (v, p, w, h);
+ videotestsrc_setup_paintinfo (v, p, frame->info.width, frame->info.height);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
y1 = 2 * h / 3;
y2 = h * 0.75;
}
void
-gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
+gst_video_test_src_smpte75 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
/* color bars */
for (j = 0; j < h; j++) {
}
void
-gst_video_test_src_smpte100 (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
+gst_video_test_src_smpte100 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
/* color bars */
for (j = 0; j < h; j++) {
}
void
-gst_video_test_src_bar (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_bar (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (j = 0; j < h; j++) {
/* use fixed size for now */
}
void
-gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_snow (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
paintinfo *p = π
struct format_list_struct *format;
struct vts_color_struct color;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
color = p->colors[COLOR_BLACK];
p->color = &color;
}
static void
-gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h, int color_index)
+gst_video_test_src_unicolor (GstVideoTestSrc * v, GstVideoFrame * frame,
+ int color_index)
{
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
p->color = p->colors + color_index;
if (color_index == COLOR_BLACK) {
}
void
-gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_black (GstVideoTestSrc * v, GstVideoFrame * frame)
{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLACK);
+ gst_video_test_src_unicolor (v, frame, COLOR_BLACK);
}
void
-gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_white (GstVideoTestSrc * v, GstVideoFrame * frame)
{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_WHITE);
+ gst_video_test_src_unicolor (v, frame, COLOR_WHITE);
}
void
-gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_red (GstVideoTestSrc * v, GstVideoFrame * frame)
{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_RED);
+ gst_video_test_src_unicolor (v, frame, COLOR_RED);
}
void
-gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_green (GstVideoTestSrc * v, GstVideoFrame * frame)
{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_GREEN);
+ gst_video_test_src_unicolor (v, frame, COLOR_GREEN);
}
void
-gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_blue (GstVideoTestSrc * v, GstVideoFrame * frame)
{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE);
+ gst_video_test_src_unicolor (v, frame, COLOR_BLUE);
}
void
-gst_video_test_src_blink (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
+gst_video_test_src_blink (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
if (v->n_frames & 1) {
p->color = &p->foreground_color;
}
void
-gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
+gst_video_test_src_solid (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
p->color = &p->foreground_color;
}
void
-gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers1 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
}
void
-gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers2 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 2) {
}
void
-gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers4 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 4) {
}
void
-gst_video_test_src_checkers8 (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_checkers8 (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 8) {
void
-gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
- int w, int h)
+gst_video_test_src_zoneplate (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
struct format_list_struct *format;
struct vts_color_struct color;
int t = v->n_frames;
+ int w = frame->info.width, h = frame->info.height;
int xreset = -(w / 2) - v->xoffset; /* starting values for x^2 and y^2, centering the ellipse */
int yreset = -(h / 2) - v->yoffset;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
color = p->colors[COLOR_BLACK];
p->color = &color;
}
void
-gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, unsigned char *dest,
- int w, int h)
+gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
struct format_list_struct *format;
struct vts_color_struct color;
int t = v->n_frames;
+ int w = frame->info.width, h = frame->info.height;
int xreset = -(w / 2) - v->xoffset; /* starting values for x^2 and y^2, centering the ellipse */
int yreset = -(h / 2) - v->yoffset;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
color = p->colors[COLOR_BLACK];
p->color = &color;
#undef SCALE_AMPLITUDE
void
-gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest,
- int w, int h)
+gst_video_test_src_circular (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
int j;
paintinfo *p = π
struct format_list_struct *format;
double freq[8];
+ int w = frame->info.width, h = frame->info.height;
int d;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (i = 1; i < 8; i++) {
freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
}
void
-gst_video_test_src_gamut (GstVideoTestSrc * v, guchar * dest, int w, int h)
+gst_video_test_src_gamut (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int x, y;
paintinfo pi = { NULL, };
struct format_list_struct *format;
struct vts_color_struct yuv_primary;
struct vts_color_struct yuv_secondary;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
for (y = 0; y < h; y++) {
int region = (y * 4) / h;
}
void
-gst_video_test_src_ball (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+gst_video_test_src_ball (GstVideoTestSrc * v, GstVideoFrame * frame)
{
int i;
paintinfo pi = { NULL, };
int t = v->n_frames;
double x, y;
int radius = 20;
+ int w = frame->info.width, h = frame->info.height;
videotestsrc_setup_paintinfo (v, p, w, h);
format = v->format;
if (format == NULL)
return;
- format->paint_setup (p, dest);
+ format->paint_setup (p, frame);
x = radius + (0.5 + 0.5 * sin (2 * G_PI * t / 200)) * (w - 2 * radius);
y = radius + (0.5 + 0.5 * sin (2 * G_PI * sqrt (2) * t / 200)) * (h -
static void
-paint_setup_I420 (paintinfo * p, unsigned char *dest)
+paint_setup_I420 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
-paint_setup_NV12 (paintinfo * p, unsigned char *dest)
+paint_setup_NV12 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
p->vp = p->up + 1;
- p->ustride = p->ystride;
- p->vstride = p->ystride;
- p->endptr = p->up + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
+ p->vstride = p->ustride;
+ p->size = frame->info.size;
}
static void
-paint_setup_NV21 (paintinfo * p, unsigned char *dest)
+paint_setup_NV21 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 1);
p->up = p->vp + 1;
- p->ustride = p->ystride;
- p->vstride = p->ystride;
- p->endptr = p->vp + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
+ p->ustride = p->vstride;
+ p->size = frame->info.size;
}
static void
static void
-paint_setup_YV12 (paintinfo * p, unsigned char *dest)
+paint_setup_YV12 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
- p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
-paint_setup_v308 (paintinfo * p, unsigned char *dest)
+paint_setup_v308 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->ustride = GST_ROUND_UP_4 (p->width * 3);
- p->vstride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->yp + 1;
+ p->vp = p->yp + 2;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_AYUV (paintinfo * p, unsigned char *dest)
+paint_setup_AYUV (paintinfo * p, GstVideoFrame * frame)
{
- p->ap = dest;
- p->yp = dest + 1;
- p->up = dest + 2;
- p->vp = dest + 3;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 1;
+ p->up = p->ap + 2;
+ p->vp = p->ap + 3;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
#ifdef disabled
static void
-paint_setup_v410 (paintinfo * p, unsigned char *dest)
+paint_setup_v410 (paintinfo * p, GstVideoFrame * frame)
{
p->yp = dest + 0;
p->up = dest + 0;
p->vp = dest + 0;
p->ystride = p->width * 4;
p->endptr = dest + p->ystride * p->height;
+ p->size = frame->info.size;
}
#endif
static void
-paint_setup_v216 (paintinfo * p, unsigned char *dest)
+paint_setup_v216 (paintinfo * p, GstVideoFrame * frame)
{
- p->ap = dest;
- p->yp = dest + 2;
- p->up = dest + 0;
- p->vp = dest + 4;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 2;
+ p->up = p->ap + 0;
+ p->vp = p->ap + 4;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_v210 (paintinfo * p, unsigned char *dest)
+paint_setup_v210 (paintinfo * p, GstVideoFrame * frame)
{
- p->ap = dest;
- p->yp = dest + 0;
- p->up = dest + 0;
- p->vp = dest + 0;
- p->ystride = ((p->width + 47) / 48) * 128; /* no, really. */
- p->endptr = dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap;
+ p->up = p->ap;
+ p->vp = p->ap;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_UYVP (paintinfo * p, unsigned char *dest)
+paint_setup_UYVP (paintinfo * p, GstVideoFrame * frame)
{
- p->ap = dest;
- p->yp = dest + 0;
- p->up = dest + 0;
- p->vp = dest + 0;
- p->ystride = GST_ROUND_UP_4 ((p->width * 2 * 5 + 3) / 4);
- GST_ERROR ("stride %d", p->ystride);
- p->endptr = dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap;
+ p->up = p->ap;
+ p->vp = p->ap;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
+paint_setup_YUY2 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 3;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->ustride = GST_ROUND_UP_2 (p->width) * 2;
- p->vstride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->yp + 1;
+ p->vp = p->yp + 3;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_UYVY (paintinfo * p, unsigned char *dest)
+paint_setup_UYVY (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 1;
- p->up = dest;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->ustride = GST_ROUND_UP_2 (p->width) * 2;
- p->vstride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
+ p->up = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->up + 1;
+ p->vp = p->up + 2;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_YVYU (paintinfo * p, unsigned char *dest)
+paint_setup_YVYU (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->up = dest + 3;
- p->vp = dest + 1;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->ustride = GST_ROUND_UP_2 (p->width) * 2;
- p->vstride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->yp + 3;
+ p->vp = p->yp + 1;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_AY64 (paintinfo * p, unsigned char *dest)
+paint_setup_AY64 (paintinfo * p, GstVideoFrame * frame)
{
- p->ap = dest;
- p->yp = dest + 2;
- p->up = dest + 4;
- p->vp = dest + 6;
- p->ystride = p->width * 8;
- p->ustride = p->width * 8;
- p->vstride = p->width * 8;
- p->endptr = dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 2;
+ p->up = p->ap + 4;
+ p->vp = p->ap + 6;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
#ifdef disabled
static void
-paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
+paint_setup_IYU2 (paintinfo * p, GstVideoFrame * frame)
{
/* untested */
- p->yp = dest + 1;
- p->up = dest + 0;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
+ p->up = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->up + 1;
+ p->vp = p->up + 2;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
#endif
static void
-paint_setup_Y41B (paintinfo * p, unsigned char *dest)
+paint_setup_Y41B (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_16 (p->width) / 4;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_16 (p->width) / 4;
- p->endptr = p->vp + p->vstride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_Y42B (paintinfo * p, unsigned char *dest)
+paint_setup_Y42B (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_8 (p->width) / 2;
- p->endptr = p->vp + p->vstride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_Y444 (paintinfo * p, unsigned char *dest)
+paint_setup_Y444 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->ustride = GST_ROUND_UP_4 (p->width);
- p->vstride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->vp = p->up + p->ystride * p->height;
- p->endptr = p->vp + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_Y800 (paintinfo * p, unsigned char *dest)
+paint_setup_Y800 (paintinfo * p, GstVideoFrame * frame)
{
/* untested */
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
+paint_setup_YVU9 (paintinfo * p, GstVideoFrame * frame)
{
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * h;
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->up = p->vp + p->vstride * h / 4;
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->up + p->ustride * h / 4;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
-paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
+paint_setup_YUV9 (paintinfo * p, GstVideoFrame * frame)
{
- /* untested */
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * h;
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->vp = p->up + p->ustride * h / 4;
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->vp + p->vstride * h / 4;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = GST_VIDEO_FRAME_DATA (frame, 1);
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 2);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = GST_VIDEO_FRAME_STRIDE (frame, 1);
+ p->vstride = GST_VIDEO_FRAME_STRIDE (frame, 2);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest)
+paint_setup_ARGB8888 (paintinfo * p, GstVideoFrame * frame)
{
- paint_setup_xRGB8888 (p, dest);
+ paint_setup_xRGB8888 (p, frame);
}
static void
-paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest)
+paint_setup_ABGR8888 (paintinfo * p, GstVideoFrame * frame)
{
- paint_setup_xBGR8888 (p, dest);
+ paint_setup_xBGR8888 (p, frame);
}
static void
-paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGBA8888 (paintinfo * p, GstVideoFrame * frame)
{
- paint_setup_RGBx8888 (p, dest);
+ paint_setup_RGBx8888 (p, frame);
}
static void
-paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGRA8888 (paintinfo * p, GstVideoFrame * frame)
{
- paint_setup_BGRx8888 (p, dest);
+ paint_setup_BGRx8888 (p, frame);
}
static void
-paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest)
+paint_setup_xRGB8888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 1;
- p->up = dest + 2;
- p->vp = dest + 3;
- p->ap = dest;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 1;
+ p->up = p->ap + 2;
+ p->vp = p->ap + 3;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest)
+paint_setup_xBGR8888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 3;
- p->up = dest + 2;
- p->vp = dest + 1;
- p->ap = dest;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 3;
+ p->up = p->ap + 2;
+ p->vp = p->ap + 1;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGBx8888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 0;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ap = dest + 3;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->yp + 1;
+ p->vp = p->yp + 2;
+ p->ap = p->yp + 3;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGRx8888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 2;
- p->up = dest + 1;
- p->vp = dest + 0;
- p->ap = dest + 3;
- p->ystride = p->width * 4;
- p->ustride = p->width * 4;
- p->vstride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->vp + 1;
+ p->yp = p->vp + 2;
+ p->ap = p->vp + 3;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
-paint_setup_RGB888 (paintinfo * p, unsigned char *dest)
+paint_setup_RGB888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 0;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->ustride = GST_ROUND_UP_4 (p->width * 3);
- p->vstride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->yp + 1;
+ p->vp = p->yp + 2;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_BGR888 (paintinfo * p, unsigned char *dest)
+paint_setup_BGR888 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 2;
- p->up = dest + 1;
- p->vp = dest + 0;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->ustride = GST_ROUND_UP_4 (p->width * 3);
- p->vstride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
+ p->vp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->up = p->vp + 1;
+ p->yp = p->vp + 2;
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_ARGB64 (paintinfo * p, unsigned char *dest)
+paint_setup_ARGB64 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest + 2;
- p->up = dest + 4;
- p->vp = dest + 6;
- p->ap = dest;
- p->ystride = p->width * 8;
- p->ustride = p->width * 8;
- p->vstride = p->width * 8;
- p->endptr = p->dest + p->ystride * p->height;
+ p->ap = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->yp = p->ap + 2;
+ p->up = p->ap + 4;
+ p->yp = p->ap + 6;
+ p->astride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ystride = p->astride;
+ p->ustride = p->astride;
+ p->vstride = p->astride;
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_RGB565 (paintinfo * p, unsigned char *dest)
+paint_setup_RGB565 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->ustride = GST_ROUND_UP_4 (p->width * 2);
- p->vstride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest)
+paint_setup_xRGB1555 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->ustride = GST_ROUND_UP_4 (p->width * 2);
- p->vstride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->ustride = p->ystride;
+ p->vstride = p->ystride;
+ p->size = frame->info.size;
}
static void
-paint_setup_bayer_bggr (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_bggr (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
p->ystride = GST_ROUND_UP_4 (p->width);
p->ustride = GST_ROUND_UP_4 (p->width);
p->vstride = GST_ROUND_UP_4 (p->width);
- p->endptr = p->dest + p->ystride * p->height;
+ p->size = p->ystride * p->height;
p->bayer_x_invert = 0;
p->bayer_y_invert = 0;
}
static void
-paint_setup_bayer_rggb (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_rggb (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
p->ystride = GST_ROUND_UP_4 (p->width);
p->ustride = GST_ROUND_UP_4 (p->width);
p->vstride = GST_ROUND_UP_4 (p->width);
- p->endptr = p->dest + p->ystride * p->height;
+ p->size = p->ystride * p->height;
p->bayer_x_invert = 1;
p->bayer_y_invert = 1;
}
static void
-paint_setup_bayer_grbg (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_grbg (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
p->ystride = GST_ROUND_UP_4 (p->width);
p->ustride = GST_ROUND_UP_4 (p->width);
p->vstride = GST_ROUND_UP_4 (p->width);
- p->endptr = p->dest + p->ystride * p->height;
+ p->size = p->ystride * p->height;
p->bayer_x_invert = 0;
p->bayer_y_invert = 1;
}
static void
-paint_setup_bayer_gbrg (paintinfo * p, unsigned char *dest)
+paint_setup_bayer_gbrg (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
p->ystride = GST_ROUND_UP_4 (p->width);
p->ustride = GST_ROUND_UP_4 (p->width);
p->vstride = GST_ROUND_UP_4 (p->width);
- p->endptr = p->dest + p->ystride * p->height;
+ p->size = p->ystride * p->height;
p->bayer_x_invert = 1;
p->bayer_y_invert = 0;
}
}
static void
-paint_setup_GRAY8 (paintinfo * p, unsigned char *dest)
+paint_setup_GRAY8 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->size = frame->info.size;
}
static void
}
static void
-paint_setup_GRAY16 (paintinfo * p, unsigned char *dest)
+paint_setup_GRAY16 (paintinfo * p, GstVideoFrame * frame)
{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = dest + p->ystride * p->height;
+ p->yp = GST_VIDEO_FRAME_DATA (frame, 0);
+ p->ystride = GST_VIDEO_FRAME_STRIDE (frame, 0);
+ p->size = frame->info.size;
}
static void