mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
videotestsrc: port to video helpers
Port videotestsrc to use the video helper functions to parse caps and handle video frames. Enable GstMetaVideo to make us handle strided video.
This commit is contained in:
parent
296630a959
commit
2732300adc
5 changed files with 517 additions and 532 deletions
|
@ -8,9 +8,10 @@ libgstvideotestsrc_la_SOURCES = \
|
||||||
videotestsrc.c
|
videotestsrc.c
|
||||||
nodist_libgstvideotestsrc_la_SOURCES = $(ORC_NODIST_SOURCES)
|
nodist_libgstvideotestsrc_la_SOURCES = $(ORC_NODIST_SOURCES)
|
||||||
|
|
||||||
libgstvideotestsrc_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
|
libgstvideotestsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
|
||||||
libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
libgstvideotestsrc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
|
libgstvideotestsrc_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
|
||||||
|
$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
|
||||||
libgstvideotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
|
libgstvideotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
|
|
||||||
noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
|
noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
|
||||||
|
|
|
@ -107,6 +107,7 @@ static gboolean gst_video_test_src_setup_allocation (GstBaseSrc * bsrc,
|
||||||
static GstFlowReturn gst_video_test_src_fill (GstPushSrc * psrc,
|
static GstFlowReturn gst_video_test_src_fill (GstPushSrc * psrc,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_video_test_src_start (GstBaseSrc * basesrc);
|
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 ())
|
#define GST_TYPE_VIDEO_TEST_SRC_PATTERN (gst_video_test_src_pattern_get_type ())
|
||||||
static GType
|
static GType
|
||||||
|
@ -304,6 +305,7 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
|
||||||
gstbasesrc_class->query = gst_video_test_src_query;
|
gstbasesrc_class->query = gst_video_test_src_query;
|
||||||
gstbasesrc_class->get_times = gst_video_test_src_get_times;
|
gstbasesrc_class->get_times = gst_video_test_src_get_times;
|
||||||
gstbasesrc_class->start = gst_video_test_src_start;
|
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;
|
gstbasesrc_class->setup_allocation = gst_video_test_src_setup_allocation;
|
||||||
|
|
||||||
gstpushsrc_class->fill = gst_video_test_src_fill;
|
gstpushsrc_class->fill = gst_video_test_src_fill;
|
||||||
|
@ -563,6 +565,23 @@ gst_video_test_src_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */
|
/* threadsafe because this gets called as the plugin is loaded */
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
||||||
|
@ -595,56 +614,32 @@ gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_video_test_src_parse_caps (const GstCaps * caps,
|
gst_video_test_src_parse_caps (const GstCaps * caps,
|
||||||
gint * width, gint * height, gint * rate_numerator, gint * rate_denominator,
|
gint * width, gint * height, gint * fps_n, gint * fps_d,
|
||||||
struct format_list_struct **format, GstVideoTestSrcColorSpec * color_spec)
|
const gchar ** color_matrix)
|
||||||
{
|
{
|
||||||
const GstStructure *structure;
|
const GstStructure *structure;
|
||||||
GstPadLinkReturn ret;
|
GstPadLinkReturn ret;
|
||||||
const GValue *framerate;
|
const GValue *framerate;
|
||||||
const char *csp;
|
|
||||||
|
|
||||||
GST_DEBUG ("parsing caps");
|
GST_DEBUG ("parsing caps");
|
||||||
|
|
||||||
if (gst_caps_get_size (caps) < 1)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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, "width", width);
|
||||||
ret &= gst_structure_get_int (structure, "height", height);
|
ret &= gst_structure_get_int (structure, "height", height);
|
||||||
framerate = gst_structure_get_value (structure, "framerate");
|
framerate = gst_structure_get_value (structure, "framerate");
|
||||||
|
|
||||||
if (framerate) {
|
if (framerate) {
|
||||||
*rate_numerator = gst_value_get_fraction_numerator (framerate);
|
*fps_n = gst_value_get_fraction_numerator (framerate);
|
||||||
*rate_denominator = gst_value_get_fraction_denominator (framerate);
|
*fps_d = gst_value_get_fraction_denominator (framerate);
|
||||||
} else
|
} else
|
||||||
goto no_framerate;
|
goto no_framerate;
|
||||||
|
|
||||||
csp = gst_structure_get_string (structure, "color-matrix");
|
*color_matrix = 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unknown_format:
|
|
||||||
{
|
|
||||||
GST_DEBUG ("videotestsrc format not found");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
no_framerate:
|
no_framerate:
|
||||||
{
|
{
|
||||||
GST_DEBUG ("videotestsrc no framerate given");
|
GST_DEBUG ("videotestsrc no framerate given");
|
||||||
|
@ -663,10 +658,16 @@ gst_video_test_src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
|
|
||||||
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
||||||
&alignment, &pool);
|
&alignment, &pool);
|
||||||
|
|
||||||
/* adjust size */
|
/* 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,
|
gst_query_set_allocation_params (query, size, min, max, prefix,
|
||||||
alignment, pool);
|
alignment, pool);
|
||||||
|
|
||||||
|
@ -676,35 +677,48 @@ gst_video_test_src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
||||||
{
|
{
|
||||||
gboolean res;
|
|
||||||
gint width, height, rate_denominator, rate_numerator;
|
|
||||||
struct format_list_struct *format;
|
struct format_list_struct *format;
|
||||||
|
const GstStructure *structure;
|
||||||
GstVideoTestSrc *videotestsrc;
|
GstVideoTestSrc *videotestsrc;
|
||||||
GstVideoTestSrcColorSpec color_spec;
|
GstVideoInfo info;
|
||||||
|
|
||||||
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
|
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
|
||||||
|
|
||||||
res = gst_video_test_src_parse_caps (caps, &width, &height,
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
&rate_numerator, &rate_denominator, &format, &color_spec);
|
|
||||||
if (!res)
|
if (gst_structure_has_name (structure, "video/x-raw")) {
|
||||||
goto parse_failed;
|
/* 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 */
|
/* looks ok here */
|
||||||
|
videotestsrc->color_spec = to_color_spec (info.color_matrix);
|
||||||
videotestsrc->format = format;
|
videotestsrc->format = format;
|
||||||
videotestsrc->width = width;
|
videotestsrc->info = info;
|
||||||
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);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
|
GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
|
||||||
videotestsrc->width, videotestsrc->height,
|
info.width, info.height, info.fps_n, info.fps_d);
|
||||||
videotestsrc->rate_numerator, videotestsrc->rate_denominator);
|
|
||||||
|
|
||||||
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 */
|
/* ERRORS */
|
||||||
parse_failed:
|
parse_failed:
|
||||||
|
@ -712,6 +726,11 @@ parse_failed:
|
||||||
GST_DEBUG_OBJECT (bsrc, "failed to parse caps");
|
GST_DEBUG_OBJECT (bsrc, "failed to parse caps");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
unknown_format:
|
||||||
|
{
|
||||||
|
GST_DEBUG ("videotestsrc format not found");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -729,61 +748,17 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
gint64 src_val, dest_val;
|
gint64 src_val, dest_val;
|
||||||
|
|
||||||
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
||||||
if (src_fmt == dest_fmt) {
|
res =
|
||||||
dest_val = src_val;
|
gst_video_info_convert (&src->info, src_fmt, src_val, dest_fmt,
|
||||||
goto done;
|
&dest_val);
|
||||||
}
|
|
||||||
|
|
||||||
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:
|
|
||||||
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
||||||
res = TRUE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
|
res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERROR */
|
|
||||||
error:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (src, "query failed");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -821,15 +796,15 @@ gst_video_test_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
|
||||||
position = segment->position;
|
position = segment->position;
|
||||||
|
|
||||||
/* now move to the position indicated */
|
/* now move to the position indicated */
|
||||||
if (src->rate_numerator) {
|
if (src->info.fps_n) {
|
||||||
src->n_frames = gst_util_uint64_scale (position,
|
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 {
|
} else {
|
||||||
src->n_frames = 0;
|
src->n_frames = 0;
|
||||||
}
|
}
|
||||||
if (src->rate_numerator) {
|
if (src->info.fps_n) {
|
||||||
src->running_time = gst_util_uint64_scale (src->n_frames,
|
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 {
|
} else {
|
||||||
/* FIXME : Not sure what to set here */
|
/* FIXME : Not sure what to set here */
|
||||||
src->running_time = 0;
|
src->running_time = 0;
|
||||||
|
@ -851,9 +826,8 @@ static GstFlowReturn
|
||||||
gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
|
gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstVideoTestSrc *src;
|
GstVideoTestSrc *src;
|
||||||
gsize size;
|
|
||||||
GstClockTime next_time;
|
GstClockTime next_time;
|
||||||
guint8 *data;
|
GstVideoFrame frame;
|
||||||
|
|
||||||
src = GST_VIDEO_TEST_SRC (psrc);
|
src = GST_VIDEO_TEST_SRC (psrc);
|
||||||
|
|
||||||
|
@ -861,32 +835,26 @@ gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
|
||||||
/* 0 framerate and we are at the second frame, eos */
|
/* 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;
|
goto eos;
|
||||||
|
|
||||||
GST_LOG_OBJECT (src,
|
GST_LOG_OBJECT (src,
|
||||||
"creating buffer from pool for frame %d", (gint) src->n_frames);
|
"creating buffer from pool for frame %d", (gint) src->n_frames);
|
||||||
|
|
||||||
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_WRITE);
|
if (!gst_video_frame_map (&frame, &src->info, buffer, GST_MAP_WRITE))
|
||||||
memset (data, 0, size);
|
goto invalid_frame;
|
||||||
src->tmpline_u8 = g_malloc (src->width + 8);
|
|
||||||
src->tmpline = g_malloc ((src->width + 8) * 4);
|
|
||||||
src->tmpline2 = g_malloc ((src->width + 8) * 4);
|
|
||||||
|
|
||||||
src->make_image (src, (void *) data, src->width, src->height);
|
src->make_image (src, &frame);
|
||||||
gst_buffer_unmap (buffer, data, size);
|
|
||||||
|
|
||||||
g_free (src->tmpline);
|
gst_video_frame_unmap (&frame);
|
||||||
g_free (src->tmpline2);
|
|
||||||
g_free (src->tmpline_u8);
|
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
|
GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
|
||||||
GST_BUFFER_OFFSET (buffer) = src->n_frames;
|
GST_BUFFER_OFFSET (buffer) = src->n_frames;
|
||||||
src->n_frames++;
|
src->n_frames++;
|
||||||
GST_BUFFER_OFFSET_END (buffer) = 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,
|
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;
|
GST_BUFFER_DURATION (buffer) = next_time - src->running_time;
|
||||||
} else {
|
} else {
|
||||||
next_time = src->timestamp_offset;
|
next_time = src->timestamp_offset;
|
||||||
|
@ -909,6 +877,11 @@ eos:
|
||||||
GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
|
GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
|
||||||
return GST_FLOW_UNEXPECTED;
|
return GST_FLOW_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
invalid_frame:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (src, "invalid frame");
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -922,6 +895,21 @@ gst_video_test_src_start (GstBaseSrc * basesrc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstpushsrc.h>
|
#include <gst/base/gstpushsrc.h>
|
||||||
|
|
||||||
|
#include <gst/video/gstmetavideo.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_VIDEO_TEST_SRC \
|
#define GST_TYPE_VIDEO_TEST_SRC \
|
||||||
|
@ -111,6 +113,7 @@ typedef enum {
|
||||||
* The color specification to use.
|
* The color specification to use.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
GST_VIDEO_TEST_SRC_UNKNOWN,
|
||||||
GST_VIDEO_TEST_SRC_BT601,
|
GST_VIDEO_TEST_SRC_BT601,
|
||||||
GST_VIDEO_TEST_SRC_BT709
|
GST_VIDEO_TEST_SRC_BT709
|
||||||
} GstVideoTestSrcColorSpec;
|
} GstVideoTestSrcColorSpec;
|
||||||
|
@ -135,14 +138,10 @@ struct _GstVideoTestSrc {
|
||||||
GstVideoTestSrcColorSpec color_spec;
|
GstVideoTestSrcColorSpec color_spec;
|
||||||
|
|
||||||
/* video state */
|
/* video state */
|
||||||
|
GstVideoInfo info;
|
||||||
|
|
||||||
char *format_name;
|
char *format_name;
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
struct format_list_struct *format;
|
struct format_list_struct *format;
|
||||||
gint bpp;
|
|
||||||
gint rate_numerator;
|
|
||||||
gint rate_denominator;
|
|
||||||
guint size;
|
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
gint64 timestamp_offset; /* base offset */
|
gint64 timestamp_offset; /* base offset */
|
||||||
|
@ -171,7 +170,7 @@ struct _GstVideoTestSrc {
|
||||||
gint horizontal_offset;
|
gint horizontal_offset;
|
||||||
gint horizontal_speed;
|
gint horizontal_speed;
|
||||||
|
|
||||||
void (*make_image) (GstVideoTestSrc *v, unsigned char *dest, int w, int h);
|
void (*make_image) (GstVideoTestSrc *v, GstVideoFrame *frame);
|
||||||
|
|
||||||
/* temporary AYUV/ARGB scanline */
|
/* temporary AYUV/ARGB scanline */
|
||||||
guint8 *tmpline_u8;
|
guint8 *tmpline_u8;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,14 +46,11 @@ struct vts_color_struct {
|
||||||
typedef struct paintinfo_struct paintinfo;
|
typedef struct paintinfo_struct paintinfo;
|
||||||
struct paintinfo_struct
|
struct paintinfo_struct
|
||||||
{
|
{
|
||||||
unsigned char *dest; /* pointer to first byte of video data */
|
unsigned char *ap, *yp, *up, *vp; /* pointers to first byte of each component
|
||||||
unsigned char *yp, *up, *vp; /* pointers to first byte of each component
|
* for both packed/planar YUV and RGB */
|
||||||
* for both packed/planar YUV and RGB */
|
int astride, ystride, ustride, vstride;
|
||||||
unsigned char *ap; /* pointer to first byte of alpha component */
|
|
||||||
unsigned char *endptr; /* pointer to byte beyond last video data */
|
int size; /* size of a frame */
|
||||||
int ystride;
|
|
||||||
int ustride;
|
|
||||||
int vstride;
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
const struct vts_color_struct *colors;
|
const struct vts_color_struct *colors;
|
||||||
|
@ -81,7 +78,7 @@ struct format_list_struct
|
||||||
const char *format;
|
const char *format;
|
||||||
const char *name;
|
const char *name;
|
||||||
int bitspp;
|
int bitspp;
|
||||||
void (*paint_setup) (paintinfo * p, unsigned char *dest);
|
void (*paint_setup) (paintinfo * p, GstVideoFrame *frame);
|
||||||
void (*convert_hline) (paintinfo * p, int y);
|
void (*convert_hline) (paintinfo * p, int y);
|
||||||
int depth;
|
int depth;
|
||||||
unsigned int red_mask;
|
unsigned int red_mask;
|
||||||
|
@ -98,49 +95,29 @@ struct format_list_struct *
|
||||||
paintinfo_find_by_structure (const GstStructure *structure);
|
paintinfo_find_by_structure (const GstStructure *structure);
|
||||||
GstStructure *
|
GstStructure *
|
||||||
paint_get_structure (struct format_list_struct *format);
|
paint_get_structure (struct format_list_struct *format);
|
||||||
|
|
||||||
int gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h);
|
int gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h);
|
||||||
void gst_video_test_src_smpte (GstVideoTestSrc * v,
|
void gst_video_test_src_smpte (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_smpte75 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_smpte75 (GstVideoTestSrc * v,
|
void gst_video_test_src_snow (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_black (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_snow (GstVideoTestSrc * v,
|
void gst_video_test_src_white (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_red (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_black (GstVideoTestSrc * v,
|
void gst_video_test_src_green (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_blue (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_white (GstVideoTestSrc * v,
|
void gst_video_test_src_solid (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_blink (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_red (GstVideoTestSrc * v,
|
void gst_video_test_src_checkers1 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_checkers2 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_green (GstVideoTestSrc * v,
|
void gst_video_test_src_checkers4 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_checkers8 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_blue (GstVideoTestSrc * v,
|
void gst_video_test_src_circular (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_zoneplate (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_solid (GstVideoTestSrc * v,
|
void gst_video_test_src_gamut (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_chromazoneplate (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_blink (GstVideoTestSrc * v,
|
void gst_video_test_src_ball (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
void gst_video_test_src_smpte100 (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
void gst_video_test_src_checkers1 (GstVideoTestSrc * v,
|
void gst_video_test_src_bar (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_checkers2 (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_checkers4 (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_checkers8 (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_circular (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_zoneplate (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_gamut (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_chromazoneplate (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_ball (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_smpte100 (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
void gst_video_test_src_bar (GstVideoTestSrc * v,
|
|
||||||
unsigned char *dest, int w, int h);
|
|
||||||
|
|
||||||
extern struct format_list_struct format_list[];
|
extern struct format_list_struct format_list[];
|
||||||
extern int n_formats;
|
extern int n_formats;
|
||||||
|
|
Loading…
Reference in a new issue