2002-07-26 22:18:57 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2005-07-19 12:01:53 +00:00
|
|
|
* Copyright (C) <2002> David A. Schleef <ds@schleef.org>
|
2002-07-26 22:18:57 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-09-11 21:45:24 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-videotestsrc
|
|
|
|
*
|
2011-09-13 19:10:43 +00:00
|
|
|
* The videotestsrc element is used to produce test video data in a wide variety
|
2006-03-01 17:39:28 +00:00
|
|
|
* of formats. The video test data produced can be controlled with the "pattern"
|
|
|
|
* property.
|
2008-07-11 06:10:24 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2007-05-04 13:10:07 +00:00
|
|
|
* <title>Example launch line</title>
|
2008-07-11 06:10:24 +00:00
|
|
|
* |[
|
2005-09-11 21:45:24 +00:00
|
|
|
* gst-launch -v videotestsrc pattern=snow ! ximagesink
|
2008-07-11 06:10:24 +00:00
|
|
|
* ]| Shows random noise in an X window.
|
2005-09-11 21:45:24 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
2005-07-19 12:01:53 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-07-27 21:51:32 +00:00
|
|
|
#include "gstvideotestsrc.h"
|
2010-09-09 08:57:41 +00:00
|
|
|
#include "gstvideotestsrcorc.h"
|
2004-07-27 21:51:32 +00:00
|
|
|
#include "videotestsrc.h"
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2002-07-28 13:40:53 +00:00
|
|
|
#include <string.h>
|
2002-07-26 22:18:57 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2006-06-23 09:53:09 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (video_test_src_debug);
|
2005-12-01 01:12:55 +00:00
|
|
|
#define GST_CAT_DEFAULT video_test_src_debug
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2008-07-01 13:22:49 +00:00
|
|
|
#define DEFAULT_PATTERN GST_VIDEO_TEST_SRC_SMPTE
|
|
|
|
#define DEFAULT_TIMESTAMP_OFFSET 0
|
|
|
|
#define DEFAULT_IS_LIVE FALSE
|
2008-11-19 00:24:44 +00:00
|
|
|
#define DEFAULT_COLOR_SPEC GST_VIDEO_TEST_SRC_BT601
|
2010-09-06 03:35:13 +00:00
|
|
|
#define DEFAULT_FOREGROUND_COLOR 0xffffffff
|
|
|
|
#define DEFAULT_BACKGROUND_COLOR 0xff000000
|
2010-09-13 03:36:19 +00:00
|
|
|
#define DEFAULT_HORIZONTAL_SPEED 0
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2002-10-04 06:49:51 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-07-19 12:01:53 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_PATTERN,
|
|
|
|
PROP_TIMESTAMP_OFFSET,
|
2008-07-01 13:22:49 +00:00
|
|
|
PROP_IS_LIVE,
|
2008-11-21 20:32:56 +00:00
|
|
|
PROP_K0,
|
|
|
|
PROP_KX,
|
|
|
|
PROP_KY,
|
|
|
|
PROP_KT,
|
|
|
|
PROP_KXT,
|
|
|
|
PROP_KYT,
|
|
|
|
PROP_KXY,
|
|
|
|
PROP_KX2,
|
|
|
|
PROP_KY2,
|
|
|
|
PROP_KT2,
|
|
|
|
PROP_XOFFSET,
|
|
|
|
PROP_YOFFSET,
|
2010-09-06 03:35:13 +00:00
|
|
|
PROP_FOREGROUND_COLOR,
|
|
|
|
PROP_BACKGROUND_COLOR,
|
2010-09-13 03:36:19 +00:00
|
|
|
PROP_HORIZONTAL_SPEED,
|
2008-07-01 13:22:49 +00:00
|
|
|
PROP_LAST
|
2002-07-26 22:18:57 +00:00
|
|
|
};
|
|
|
|
|
2004-08-04 11:08:13 +00:00
|
|
|
|
2011-04-19 09:35:53 +00:00
|
|
|
#define gst_video_test_src_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstVideoTestSrc, gst_video_test_src, GST_TYPE_PUSH_SRC);
|
2005-07-19 12:01:53 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
|
2004-03-14 22:34:34 +00:00
|
|
|
int pattern_type);
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_test_src_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_test_src_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2011-05-11 15:39:06 +00:00
|
|
|
static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc,
|
|
|
|
GstCaps * filter);
|
2005-12-01 01:12:55 +00:00
|
|
|
static gboolean gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
|
2012-03-11 18:04:41 +00:00
|
|
|
static GstCaps *gst_video_test_src_src_fixate (GstBaseSrc * bsrc,
|
|
|
|
GstCaps * caps);
|
2005-11-14 12:15:01 +00:00
|
|
|
|
2005-12-12 15:09:55 +00:00
|
|
|
static gboolean gst_video_test_src_is_seekable (GstBaseSrc * psrc);
|
|
|
|
static gboolean gst_video_test_src_do_seek (GstBaseSrc * bsrc,
|
|
|
|
GstSegment * segment);
|
2011-05-17 09:25:31 +00:00
|
|
|
static gboolean gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query);
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_test_src_get_times (GstBaseSrc * basesrc,
|
2005-11-10 14:58:41 +00:00
|
|
|
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
2011-08-26 12:20:30 +00:00
|
|
|
static gboolean gst_video_test_src_decide_allocation (GstBaseSrc * bsrc,
|
2011-06-13 10:09:34 +00:00
|
|
|
GstQuery * query);
|
|
|
|
static GstFlowReturn gst_video_test_src_fill (GstPushSrc * psrc,
|
|
|
|
GstBuffer * buffer);
|
2005-12-27 22:29:43 +00:00
|
|
|
static gboolean gst_video_test_src_start (GstBaseSrc * basesrc);
|
2011-06-21 15:33:27 +00:00
|
|
|
static gboolean gst_video_test_src_stop (GstBaseSrc * basesrc);
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
#define GST_TYPE_VIDEO_TEST_SRC_PATTERN (gst_video_test_src_pattern_get_type ())
|
2003-04-23 07:38:32 +00:00
|
|
|
static GType
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_pattern_get_type (void)
|
2003-04-23 07:38:32 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
static GType video_test_src_pattern_type = 0;
|
Const-ify GEnumValue and GFlagsValue arrays. Use
Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 19:24:46 +00:00
|
|
|
static const GEnumValue pattern_types[] = {
|
2005-12-01 01:12:55 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_SMPTE, "SMPTE 100% color bars", "smpte"},
|
|
|
|
{GST_VIDEO_TEST_SRC_SNOW, "Random (television snow)", "snow"},
|
|
|
|
{GST_VIDEO_TEST_SRC_BLACK, "100% Black", "black"},
|
gst/videotestsrc/: Add more uni-colour patterns ("white", "red", "green", and "blue").
Original commit message from CVS:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type),
(gst_video_test_src_set_pattern):
* gst/videotestsrc/gstvideotestsrc.h:
* gst/videotestsrc/videotestsrc.c: (gst_video_test_src_unicolor),
(gst_video_test_src_black), (gst_video_test_src_white),
(gst_video_test_src_red), (gst_video_test_src_green),
(gst_video_test_src_blue):
* gst/videotestsrc/videotestsrc.h:
Add more uni-colour patterns ("white", "red", "green", and "blue").
2006-09-01 16:12:35 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_WHITE, "100% White", "white"},
|
|
|
|
{GST_VIDEO_TEST_SRC_RED, "Red", "red"},
|
|
|
|
{GST_VIDEO_TEST_SRC_GREEN, "Green", "green"},
|
|
|
|
{GST_VIDEO_TEST_SRC_BLUE, "Blue", "blue"},
|
2006-10-23 12:46:41 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_CHECKERS1, "Checkers 1px", "checkers-1"},
|
|
|
|
{GST_VIDEO_TEST_SRC_CHECKERS2, "Checkers 2px", "checkers-2"},
|
|
|
|
{GST_VIDEO_TEST_SRC_CHECKERS4, "Checkers 4px", "checkers-4"},
|
|
|
|
{GST_VIDEO_TEST_SRC_CHECKERS8, "Checkers 8px", "checkers-8"},
|
2007-04-04 02:45:03 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_CIRCULAR, "Circular", "circular"},
|
2007-12-18 01:01:23 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_BLINK, "Blink", "blink"},
|
2008-11-19 00:24:44 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_SMPTE75, "SMPTE 75% color bars", "smpte75"},
|
2008-11-21 20:32:56 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_ZONE_PLATE, "Zone plate", "zone-plate"},
|
2009-10-07 02:35:50 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_GAMUT, "Gamut checkers", "gamut"},
|
2010-03-15 08:35:15 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE, "Chroma zone plate",
|
|
|
|
"chroma-zone-plate"},
|
2010-07-21 12:20:03 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_SOLID, "Solid color", "solid-color"},
|
2010-08-23 05:16:45 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_BALL, "Moving ball", "ball"},
|
2010-09-13 03:36:19 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_SMPTE100, "SMPTE 100% color bars", "smpte100"},
|
2010-09-16 15:14:20 +00:00
|
|
|
{GST_VIDEO_TEST_SRC_BAR, "Bar", "bar"},
|
gst/videotestsrc/: Add more uni-colour patterns ("white", "red", "green", and "blue").
Original commit message from CVS:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type),
(gst_video_test_src_set_pattern):
* gst/videotestsrc/gstvideotestsrc.h:
* gst/videotestsrc/videotestsrc.c: (gst_video_test_src_unicolor),
(gst_video_test_src_black), (gst_video_test_src_white),
(gst_video_test_src_red), (gst_video_test_src_green),
(gst_video_test_src_blue):
* gst/videotestsrc/videotestsrc.h:
Add more uni-colour patterns ("white", "red", "green", and "blue").
2006-09-01 16:12:35 +00:00
|
|
|
{0, NULL, NULL}
|
2003-04-23 07:38:32 +00:00
|
|
|
};
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
if (!video_test_src_pattern_type) {
|
|
|
|
video_test_src_pattern_type =
|
2005-07-19 12:01:53 +00:00
|
|
|
g_enum_register_static ("GstVideoTestSrcPattern", pattern_types);
|
2003-04-23 07:38:32 +00:00
|
|
|
}
|
2005-12-01 01:12:55 +00:00
|
|
|
return video_test_src_pattern_type;
|
2003-04-23 07:38:32 +00:00
|
|
|
}
|
|
|
|
|
2002-07-26 22:18:57 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
|
2002-07-26 22:18:57 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2011-04-19 09:35:53 +00:00
|
|
|
GstElementClass *gstelement_class;
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2011-05-17 11:04:27 +00:00
|
|
|
GstCaps *templ_caps;
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2002-10-04 06:49:51 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2011-04-19 09:35:53 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
|
|
|
gstpushsrc_class = (GstPushSrcClass *) klass;
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
gobject_class->set_property = gst_video_test_src_set_property;
|
|
|
|
gobject_class->get_property = gst_video_test_src_get_property;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PATTERN,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_enum ("pattern", "Pattern",
|
2005-12-01 01:12:55 +00:00
|
|
|
"Type of test pattern to generate", GST_TYPE_VIDEO_TEST_SRC_PATTERN,
|
2008-07-01 13:22:49 +00:00
|
|
|
DEFAULT_PATTERN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2008-03-22 15:00:53 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TIMESTAMP_OFFSET,
|
|
|
|
g_param_spec_int64 ("timestamp-offset", "Timestamp offset",
|
2005-07-19 12:01:53 +00:00
|
|
|
"An offset added to timestamps set on buffers (in ns)", G_MININT64,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_MAXINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-09-28 13:36:45 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_IS_LIVE,
|
|
|
|
g_param_spec_boolean ("is-live", "Is Live",
|
2008-07-01 13:22:49 +00:00
|
|
|
"Whether to act as a live source", DEFAULT_IS_LIVE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2008-11-21 20:32:56 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_K0,
|
|
|
|
g_param_spec_int ("k0", "Zoneplate zero order phase",
|
|
|
|
"Zoneplate zero order phase, for generating plain fields or phase offsets",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KX,
|
|
|
|
g_param_spec_int ("kx", "Zoneplate 1st order x phase",
|
|
|
|
"Zoneplate 1st order x phase, for generating constant horizontal frequencies",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KY,
|
|
|
|
g_param_spec_int ("ky", "Zoneplate 1st order y phase",
|
|
|
|
"Zoneplate 1st order y phase, for generating contant vertical frequencies",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KT,
|
|
|
|
g_param_spec_int ("kt", "Zoneplate 1st order t phase",
|
|
|
|
"Zoneplate 1st order t phase, for generating phase rotation as a function of time",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KXT,
|
|
|
|
g_param_spec_int ("kxt", "Zoneplate x*t product phase",
|
|
|
|
"Zoneplate x*t product phase, normalised to kxy/256 cycles per vertical pixel at width/2 from origin",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KYT,
|
|
|
|
g_param_spec_int ("kyt", "Zoneplate y*t product phase",
|
|
|
|
"Zoneplate y*t product phase", G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KXY,
|
|
|
|
g_param_spec_int ("kxy", "Zoneplate x*y product phase",
|
2010-09-02 09:57:42 +00:00
|
|
|
"Zoneplate x*y product phase", G_MININT32, G_MAXINT32, 0,
|
2008-11-21 20:32:56 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KX2,
|
|
|
|
g_param_spec_int ("kx2", "Zoneplate 2nd order x phase",
|
|
|
|
"Zoneplate 2nd order x phase, normalised to kx2/256 cycles per horizontal pixel at width/2 from origin",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KY2,
|
|
|
|
g_param_spec_int ("ky2", "Zoneplate 2nd order y phase",
|
|
|
|
"Zoneplate 2nd order y phase, normailsed to ky2/256 cycles per vertical pixel at height/2 from origin",
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_KT2,
|
|
|
|
g_param_spec_int ("kt2", "Zoneplate 2nd order t phase",
|
|
|
|
"Zoneplate 2nd order t phase, t*t/256 cycles per picture", G_MININT32,
|
|
|
|
G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_XOFFSET,
|
|
|
|
g_param_spec_int ("xoffset", "Zoneplate 2nd order products x offset",
|
|
|
|
"Zoneplate 2nd order products x offset", G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_YOFFSET,
|
|
|
|
g_param_spec_int ("yoffset", "Zoneplate 2nd order products y offset",
|
|
|
|
"Zoneplate 2nd order products y offset", G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-07-21 12:20:03 +00:00
|
|
|
/**
|
2010-09-06 03:35:13 +00:00
|
|
|
* GstVideoTestSrc:foreground-color
|
2010-07-21 12:20:03 +00:00
|
|
|
*
|
2010-09-06 03:35:13 +00:00
|
|
|
* Color to use for solid-color pattern and foreground color of other
|
|
|
|
* patterns. Default is white (0xffffffff).
|
2010-07-21 12:20:03 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
|
|
|
**/
|
2010-09-06 03:35:13 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FOREGROUND_COLOR,
|
|
|
|
g_param_spec_uint ("foreground-color", "Foreground Color",
|
|
|
|
"Foreground color to use (big-endian ARGB)", 0, G_MAXUINT32,
|
|
|
|
DEFAULT_FOREGROUND_COLOR,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
/**
|
|
|
|
* GstVideoTestSrc:background-color
|
|
|
|
*
|
|
|
|
* Color to use for background color of some patterns. Default is
|
|
|
|
* black (0xff000000).
|
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
|
|
|
**/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_BACKGROUND_COLOR,
|
|
|
|
g_param_spec_uint ("background-color", "Background Color",
|
|
|
|
"Background color to use (big-endian ARGB)", 0, G_MAXUINT32,
|
|
|
|
DEFAULT_BACKGROUND_COLOR,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2003-05-01 06:24:34 +00:00
|
|
|
|
2010-09-13 03:36:19 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HORIZONTAL_SPEED,
|
|
|
|
g_param_spec_int ("horizontal-speed", "Horizontal Speed",
|
|
|
|
"Scroll image number of pixels per frame (positive is scroll to the left)",
|
|
|
|
G_MININT32, G_MAXINT32, DEFAULT_HORIZONTAL_SPEED,
|
2010-09-01 13:18:31 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2012-04-09 23:45:16 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2011-04-19 09:35:53 +00:00
|
|
|
"Video test source", "Source/Video",
|
|
|
|
"Creates a test video stream", "David A. Schleef <ds@schleef.org>");
|
|
|
|
|
2011-05-17 11:04:27 +00:00
|
|
|
templ_caps = gst_video_test_src_getcaps (NULL, NULL);
|
2011-04-19 09:35:53 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2011-05-17 11:04:27 +00:00
|
|
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps));
|
|
|
|
gst_caps_unref (templ_caps);
|
2011-04-19 09:35:53 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
|
|
|
|
gstbasesrc_class->set_caps = gst_video_test_src_setcaps;
|
2011-08-17 15:18:20 +00:00
|
|
|
gstbasesrc_class->fixate = gst_video_test_src_src_fixate;
|
2005-12-12 15:09:55 +00:00
|
|
|
gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable;
|
|
|
|
gstbasesrc_class->do_seek = gst_video_test_src_do_seek;
|
|
|
|
gstbasesrc_class->query = gst_video_test_src_query;
|
2005-12-01 01:12:55 +00:00
|
|
|
gstbasesrc_class->get_times = gst_video_test_src_get_times;
|
2005-12-27 22:29:43 +00:00
|
|
|
gstbasesrc_class->start = gst_video_test_src_start;
|
2011-06-21 15:33:27 +00:00
|
|
|
gstbasesrc_class->stop = gst_video_test_src_stop;
|
2011-08-26 12:20:30 +00:00
|
|
|
gstbasesrc_class->decide_allocation = gst_video_test_src_decide_allocation;
|
2005-12-12 15:09:55 +00:00
|
|
|
|
2011-06-13 10:09:34 +00:00
|
|
|
gstpushsrc_class->fill = gst_video_test_src_fill;
|
2002-07-26 22:18:57 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
static void
|
2011-04-19 09:35:53 +00:00
|
|
|
gst_video_test_src_init (GstVideoTestSrc * src)
|
2003-12-22 01:47:09 +00:00
|
|
|
{
|
2008-07-01 13:22:49 +00:00
|
|
|
gst_video_test_src_set_pattern (src, DEFAULT_PATTERN);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2008-07-01 13:22:49 +00:00
|
|
|
src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
|
2010-09-06 03:35:13 +00:00
|
|
|
src->foreground_color = DEFAULT_FOREGROUND_COLOR;
|
|
|
|
src->background_color = DEFAULT_BACKGROUND_COLOR;
|
2010-09-13 03:36:19 +00:00
|
|
|
src->horizontal_speed = DEFAULT_HORIZONTAL_SPEED;
|
2005-09-28 13:36:45 +00:00
|
|
|
|
2005-12-12 15:09:55 +00:00
|
|
|
/* we operate in time */
|
|
|
|
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
|
2008-07-01 13:22:49 +00:00
|
|
|
gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
|
2005-07-19 12:01:53 +00:00
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2012-03-11 18:04:41 +00:00
|
|
|
static GstCaps *
|
2011-08-17 15:18:20 +00:00
|
|
|
gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
|
2005-11-14 12:15:01 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2012-03-11 18:04:41 +00:00
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
|
2005-11-14 12:15:01 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
2005-11-21 14:29:53 +00:00
|
|
|
gst_structure_fixate_field_nearest_int (structure, "width", 320);
|
|
|
|
gst_structure_fixate_field_nearest_int (structure, "height", 240);
|
Updates for API changes
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
* gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
(gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
(gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
Updates for API changes
2005-11-23 13:25:54 +00:00
|
|
|
gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
|
2010-05-11 14:12:49 +00:00
|
|
|
if (gst_structure_has_field (structure, "pixel-aspect-ratio"))
|
|
|
|
gst_structure_fixate_field_nearest_fraction (structure,
|
|
|
|
"pixel-aspect-ratio", 1, 1);
|
2011-08-23 16:57:35 +00:00
|
|
|
if (gst_structure_has_field (structure, "colorimetry"))
|
|
|
|
gst_structure_fixate_field_string (structure, "colorimetry", "bt601");
|
2010-05-22 08:05:40 +00:00
|
|
|
if (gst_structure_has_field (structure, "chroma-site"))
|
|
|
|
gst_structure_fixate_field_string (structure, "chroma-site", "mpeg2");
|
|
|
|
|
|
|
|
if (gst_structure_has_field (structure, "interlaced"))
|
|
|
|
gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
|
2011-08-17 15:18:20 +00:00
|
|
|
|
2012-03-11 18:04:41 +00:00
|
|
|
caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
|
|
|
|
|
|
|
|
return caps;
|
2005-11-14 12:15:01 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
|
|
|
|
int pattern_type)
|
2005-07-19 12:01:53 +00:00
|
|
|
{
|
|
|
|
videotestsrc->pattern_type = pattern_type;
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
GST_DEBUG_OBJECT (videotestsrc, "setting pattern to %d", pattern_type);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
switch (pattern_type) {
|
2005-12-01 01:12:55 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_SMPTE:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_smpte;
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
2005-12-01 01:12:55 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_SNOW:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_snow;
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
2005-12-01 01:12:55 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_BLACK:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_black;
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
gst/videotestsrc/: Add more uni-colour patterns ("white", "red", "green", and "blue").
Original commit message from CVS:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type),
(gst_video_test_src_set_pattern):
* gst/videotestsrc/gstvideotestsrc.h:
* gst/videotestsrc/videotestsrc.c: (gst_video_test_src_unicolor),
(gst_video_test_src_black), (gst_video_test_src_white),
(gst_video_test_src_red), (gst_video_test_src_green),
(gst_video_test_src_blue):
* gst/videotestsrc/videotestsrc.h:
Add more uni-colour patterns ("white", "red", "green", and "blue").
2006-09-01 16:12:35 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_WHITE:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_white;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_RED:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_red;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_GREEN:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_green;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_BLUE:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_blue;
|
|
|
|
break;
|
2006-10-23 12:46:41 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_CHECKERS1:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_checkers1;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_CHECKERS2:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_checkers2;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_CHECKERS4:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_checkers4;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_TEST_SRC_CHECKERS8:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_checkers8;
|
|
|
|
break;
|
2007-04-04 02:45:03 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_CIRCULAR:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_circular;
|
|
|
|
break;
|
2007-12-18 01:01:23 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_BLINK:
|
2010-09-11 01:10:40 +00:00
|
|
|
videotestsrc->make_image = gst_video_test_src_blink;
|
2007-12-18 01:01:23 +00:00
|
|
|
break;
|
2008-11-19 00:24:44 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_SMPTE75:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_smpte75;
|
|
|
|
break;
|
2008-11-21 20:32:56 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_ZONE_PLATE:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_zoneplate;
|
|
|
|
break;
|
2009-10-07 02:35:50 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_GAMUT:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_gamut;
|
|
|
|
break;
|
2010-03-15 08:35:15 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_chromazoneplate;
|
|
|
|
break;
|
2010-07-21 12:20:03 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_SOLID:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_solid;
|
|
|
|
break;
|
2010-08-23 05:16:45 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_BALL:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_ball;
|
|
|
|
break;
|
2010-09-13 03:36:19 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_SMPTE100:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_smpte100;
|
2010-09-01 13:18:31 +00:00
|
|
|
break;
|
2010-09-16 15:14:20 +00:00
|
|
|
case GST_VIDEO_TEST_SRC_BAR:
|
|
|
|
videotestsrc->make_image = gst_video_test_src_bar;
|
|
|
|
break;
|
2005-07-19 12:01:53 +00:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_set_property (GObject * object, guint prop_id,
|
2005-07-19 12:01:53 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (object);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PATTERN:
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_set_pattern (src, g_value_get_enum (value));
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
|
|
|
case PROP_TIMESTAMP_OFFSET:
|
2005-09-28 13:36:45 +00:00
|
|
|
src->timestamp_offset = g_value_get_int64 (value);
|
|
|
|
break;
|
|
|
|
case PROP_IS_LIVE:
|
|
|
|
gst_base_src_set_live (GST_BASE_SRC (src), g_value_get_boolean (value));
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
2008-11-21 20:32:56 +00:00
|
|
|
case PROP_K0:
|
|
|
|
src->k0 = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KX:
|
|
|
|
src->kx = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KY:
|
|
|
|
src->ky = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KT:
|
|
|
|
src->kt = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KXT:
|
|
|
|
src->kxt = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KYT:
|
|
|
|
src->kyt = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KXY:
|
|
|
|
src->kxy = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KX2:
|
|
|
|
src->kx2 = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KY2:
|
|
|
|
src->ky2 = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_KT2:
|
|
|
|
src->kt2 = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_XOFFSET:
|
|
|
|
src->xoffset = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_YOFFSET:
|
|
|
|
src->yoffset = g_value_get_int (value);
|
|
|
|
break;
|
2010-09-06 03:35:13 +00:00
|
|
|
case PROP_FOREGROUND_COLOR:
|
|
|
|
src->foreground_color = g_value_get_uint (value);
|
|
|
|
break;
|
|
|
|
case PROP_BACKGROUND_COLOR:
|
|
|
|
src->background_color = g_value_get_uint (value);
|
2010-07-21 12:20:03 +00:00
|
|
|
break;
|
2010-09-13 03:36:19 +00:00
|
|
|
case PROP_HORIZONTAL_SPEED:
|
|
|
|
src->horizontal_speed = g_value_get_int (value);
|
2005-07-19 12:01:53 +00:00
|
|
|
default:
|
|
|
|
break;
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
}
|
2005-07-19 12:01:53 +00:00
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2005-07-19 12:01:53 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
2005-07-19 12:01:53 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (object);
|
2005-07-19 12:01:53 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PATTERN:
|
2005-09-28 13:36:45 +00:00
|
|
|
g_value_set_enum (value, src->pattern_type);
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
|
|
|
case PROP_TIMESTAMP_OFFSET:
|
2005-09-28 13:36:45 +00:00
|
|
|
g_value_set_int64 (value, src->timestamp_offset);
|
|
|
|
break;
|
|
|
|
case PROP_IS_LIVE:
|
|
|
|
g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src)));
|
2005-07-19 12:01:53 +00:00
|
|
|
break;
|
2008-11-21 20:32:56 +00:00
|
|
|
case PROP_K0:
|
|
|
|
g_value_set_int (value, src->k0);
|
|
|
|
break;
|
|
|
|
case PROP_KX:
|
|
|
|
g_value_set_int (value, src->kx);
|
|
|
|
break;
|
|
|
|
case PROP_KY:
|
|
|
|
g_value_set_int (value, src->ky);
|
|
|
|
break;
|
|
|
|
case PROP_KT:
|
|
|
|
g_value_set_int (value, src->kt);
|
|
|
|
break;
|
|
|
|
case PROP_KXT:
|
|
|
|
g_value_set_int (value, src->kxt);
|
|
|
|
break;
|
|
|
|
case PROP_KYT:
|
|
|
|
g_value_set_int (value, src->kyt);
|
|
|
|
break;
|
|
|
|
case PROP_KXY:
|
|
|
|
g_value_set_int (value, src->kxy);
|
|
|
|
break;
|
|
|
|
case PROP_KX2:
|
|
|
|
g_value_set_int (value, src->kx2);
|
|
|
|
break;
|
|
|
|
case PROP_KY2:
|
|
|
|
g_value_set_int (value, src->ky2);
|
|
|
|
break;
|
|
|
|
case PROP_KT2:
|
|
|
|
g_value_set_int (value, src->kt2);
|
|
|
|
break;
|
|
|
|
case PROP_XOFFSET:
|
|
|
|
g_value_set_int (value, src->xoffset);
|
|
|
|
break;
|
|
|
|
case PROP_YOFFSET:
|
|
|
|
g_value_set_int (value, src->yoffset);
|
|
|
|
break;
|
2010-09-06 03:35:13 +00:00
|
|
|
case PROP_FOREGROUND_COLOR:
|
|
|
|
g_value_set_uint (value, src->foreground_color);
|
|
|
|
break;
|
|
|
|
case PROP_BACKGROUND_COLOR:
|
|
|
|
g_value_set_uint (value, src->background_color);
|
2010-07-21 12:20:03 +00:00
|
|
|
break;
|
2010-09-13 03:36:19 +00:00
|
|
|
case PROP_HORIZONTAL_SPEED:
|
|
|
|
g_value_set_int (value, src->horizontal_speed);
|
2010-09-01 13:18:31 +00:00
|
|
|
break;
|
2005-07-19 12:01:53 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* threadsafe because this gets called as the plugin is loaded */
|
|
|
|
static GstCaps *
|
2011-05-11 15:39:06 +00:00
|
|
|
gst_video_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
2005-07-19 12:01:53 +00:00
|
|
|
{
|
|
|
|
static GstCaps *capslist = NULL;
|
|
|
|
|
|
|
|
if (!capslist) {
|
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *structure;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
2011-06-16 10:48:33 +00:00
|
|
|
for (i = 0; i < n_formats; i++) {
|
|
|
|
structure = paint_get_structure (format_list + i);
|
2005-07-19 12:01:53 +00:00
|
|
|
gst_structure_set (structure,
|
|
|
|
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
|
|
|
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
2005-07-19 12:01:53 +00:00
|
|
|
gst_caps_append_structure (caps, structure);
|
|
|
|
}
|
|
|
|
|
|
|
|
capslist = caps;
|
|
|
|
}
|
|
|
|
|
2011-05-11 15:39:06 +00:00
|
|
|
if (filter)
|
|
|
|
return gst_caps_intersect_full (filter, capslist, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
else
|
|
|
|
return gst_caps_ref (capslist);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_parse_caps (const GstCaps * caps,
|
2011-06-21 15:33:27 +00:00
|
|
|
gint * width, gint * height, gint * fps_n, gint * fps_d,
|
2011-08-23 16:57:35 +00:00
|
|
|
GstVideoColorimetry * colorimetry)
|
2002-07-26 22:18:57 +00:00
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
const GstStructure *structure;
|
|
|
|
GstPadLinkReturn ret;
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
const GValue *framerate;
|
2011-08-23 16:57:35 +00:00
|
|
|
const gchar *csp;
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_DEBUG ("parsing caps");
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2003-06-10 16:22:41 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
ret = gst_structure_get_int (structure, "width", width);
|
|
|
|
ret &= gst_structure_get_int (structure, "height", height);
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
framerate = gst_structure_get_value (structure, "framerate");
|
|
|
|
|
|
|
|
if (framerate) {
|
2011-06-21 15:33:27 +00:00
|
|
|
*fps_n = gst_value_get_fraction_numerator (framerate);
|
|
|
|
*fps_d = gst_value_get_fraction_denominator (framerate);
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
} else
|
2005-12-12 15:09:55 +00:00
|
|
|
goto no_framerate;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-08-23 16:57:35 +00:00
|
|
|
if ((csp = gst_structure_get_string (structure, "colorimetry")))
|
|
|
|
gst_video_colorimetry_from_string (colorimetry, csp);
|
2010-01-31 06:55:01 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return ret;
|
2005-12-12 15:09:55 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_framerate:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("videotestsrc no framerate given");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2003-04-16 07:52:54 +00:00
|
|
|
|
2011-06-13 10:09:34 +00:00
|
|
|
static gboolean
|
2011-08-26 12:20:30 +00:00
|
|
|
gst_video_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
2011-06-13 10:09:34 +00:00
|
|
|
{
|
|
|
|
GstVideoTestSrc *videotestsrc;
|
2012-03-16 19:22:19 +00:00
|
|
|
GstBufferPool *pool;
|
|
|
|
gboolean update;
|
|
|
|
guint size, min, max;
|
|
|
|
GstStructure *config;
|
2011-06-13 10:09:34 +00:00
|
|
|
|
|
|
|
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
|
|
|
|
|
2012-03-15 19:36:51 +00:00
|
|
|
if (gst_query_get_n_allocation_pools (query) > 0) {
|
|
|
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
2011-06-13 10:09:34 +00:00
|
|
|
|
2012-03-15 19:36:51 +00:00
|
|
|
/* adjust size */
|
|
|
|
size = MAX (size, videotestsrc->info.size);
|
2012-03-16 19:22:19 +00:00
|
|
|
update = TRUE;
|
|
|
|
} else {
|
|
|
|
pool = NULL;
|
|
|
|
size = videotestsrc->info.size;
|
|
|
|
min = max = 0;
|
|
|
|
update = FALSE;
|
|
|
|
}
|
2012-03-15 19:36:51 +00:00
|
|
|
|
2012-03-16 19:22:19 +00:00
|
|
|
/* no downstream pool, make our own */
|
|
|
|
if (pool == NULL) {
|
|
|
|
pool = gst_video_buffer_pool_new ();
|
|
|
|
}
|
2011-06-13 10:09:34 +00:00
|
|
|
|
2012-03-16 19:22:19 +00:00
|
|
|
config = gst_buffer_pool_get_config (pool);
|
|
|
|
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
|
|
|
|
gst_buffer_pool_config_add_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
|
|
|
}
|
|
|
|
gst_buffer_pool_set_config (pool, config);
|
|
|
|
|
|
|
|
if (update)
|
2012-03-15 19:36:51 +00:00
|
|
|
gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
|
2012-03-16 19:22:19 +00:00
|
|
|
else
|
|
|
|
gst_query_add_allocation_pool (query, pool, size, min, max);
|
|
|
|
|
|
|
|
if (pool)
|
|
|
|
gst_object_unref (pool);
|
2012-03-12 18:51:21 +00:00
|
|
|
|
2012-04-30 11:06:26 +00:00
|
|
|
return GST_BASE_SRC_CLASS (parent_class)->decide_allocation (bsrc, query);
|
2011-06-13 10:09:34 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2011-06-16 10:48:33 +00:00
|
|
|
struct format_list_struct *format;
|
2011-06-21 15:33:27 +00:00
|
|
|
const GstStructure *structure;
|
2005-07-19 12:01:53 +00:00
|
|
|
GstVideoTestSrc *videotestsrc;
|
2011-06-21 15:33:27 +00:00
|
|
|
GstVideoInfo info;
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
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;
|
|
|
|
|
2012-03-05 11:42:27 +00:00
|
|
|
} else if (gst_structure_has_name (structure, "video/x-bayer")) {
|
2011-06-21 15:33:27 +00:00
|
|
|
if (!gst_video_test_src_parse_caps (caps, &info.width, &info.height,
|
2011-08-23 16:57:35 +00:00
|
|
|
&info.fps_n, &info.fps_d, &info.colorimetry))
|
2011-06-21 15:33:27 +00:00
|
|
|
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;
|
2011-04-29 10:10:14 +00:00
|
|
|
|
|
|
|
/* looks ok here */
|
2011-06-16 10:48:33 +00:00
|
|
|
videotestsrc->format = format;
|
2011-06-21 15:33:27 +00:00
|
|
|
videotestsrc->info = info;
|
2011-04-29 10:10:14 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
|
2011-06-21 15:33:27 +00:00
|
|
|
info.width, info.height, info.fps_n, info.fps_d);
|
2011-04-29 10:10:14 +00:00
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
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;
|
2011-04-29 10:10:14 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
parse_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (bsrc, "failed to parse caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-06-21 15:33:27 +00:00
|
|
|
unknown_format:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("videotestsrc format not found");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-26 22:18:57 +00:00
|
|
|
}
|
|
|
|
|
2004-06-18 22:32:44 +00:00
|
|
|
static gboolean
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
2004-06-18 22:32:44 +00:00
|
|
|
{
|
2005-12-12 15:09:55 +00:00
|
|
|
gboolean res;
|
|
|
|
GstVideoTestSrc *src;
|
2004-06-18 22:32:44 +00:00
|
|
|
|
2005-12-12 15:09:55 +00:00
|
|
|
src = GST_VIDEO_TEST_SRC (bsrc);
|
2004-06-18 22:32:44 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2005-12-12 15:09:55 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
2004-06-18 22:32:44 +00:00
|
|
|
{
|
2005-12-12 15:09:55 +00:00
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
2011-06-21 15:33:27 +00:00
|
|
|
res =
|
|
|
|
gst_video_info_convert (&src->info, src_fmt, src_val, dest_fmt,
|
|
|
|
&dest_val);
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
2004-06-18 22:32:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2005-12-12 15:09:55 +00:00
|
|
|
res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
|
2011-06-21 15:33:27 +00:00
|
|
|
break;
|
2004-06-18 22:32:44 +00:00
|
|
|
}
|
2005-12-12 15:09:55 +00:00
|
|
|
return res;
|
2004-06-18 22:32:44 +00:00
|
|
|
}
|
2003-12-14 21:25:32 +00:00
|
|
|
|
2005-11-10 14:58:41 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_test_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
|
2005-11-10 14:58:41 +00:00
|
|
|
GstClockTime * start, GstClockTime * end)
|
2005-09-28 13:36:45 +00:00
|
|
|
{
|
2005-11-10 14:58:41 +00:00
|
|
|
/* for live sources, sync on the timestamp of the buffer */
|
|
|
|
if (gst_base_src_is_live (basesrc)) {
|
|
|
|
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
2005-09-28 13:36:45 +00:00
|
|
|
|
2005-11-10 14:58:41 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
/* get duration to calculate end time */
|
|
|
|
GstClockTime duration = GST_BUFFER_DURATION (buffer);
|
2005-09-28 13:36:45 +00:00
|
|
|
|
2005-11-10 14:58:41 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
|
|
|
*end = timestamp + duration;
|
|
|
|
}
|
|
|
|
*start = timestamp;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*start = -1;
|
|
|
|
*end = -1;
|
|
|
|
}
|
2005-09-28 13:36:45 +00:00
|
|
|
}
|
|
|
|
|
2005-12-12 15:09:55 +00:00
|
|
|
static gboolean
|
|
|
|
gst_video_test_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
|
|
|
|
{
|
2011-05-16 11:48:11 +00:00
|
|
|
GstClockTime position;
|
2005-12-12 15:09:55 +00:00
|
|
|
GstVideoTestSrc *src;
|
|
|
|
|
|
|
|
src = GST_VIDEO_TEST_SRC (bsrc);
|
|
|
|
|
2007-05-17 11:16:14 +00:00
|
|
|
segment->time = segment->start;
|
2011-05-16 11:48:11 +00:00
|
|
|
position = segment->position;
|
2005-12-12 15:09:55 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
/* now move to the position indicated */
|
2011-06-21 15:33:27 +00:00
|
|
|
if (src->info.fps_n) {
|
2011-05-16 11:48:11 +00:00
|
|
|
src->n_frames = gst_util_uint64_scale (position,
|
2011-06-21 15:33:27 +00:00
|
|
|
src->info.fps_n, src->info.fps_d * GST_SECOND);
|
2006-03-23 11:18:19 +00:00
|
|
|
} else {
|
|
|
|
src->n_frames = 0;
|
|
|
|
}
|
2011-06-21 15:33:27 +00:00
|
|
|
if (src->info.fps_n) {
|
2006-03-23 11:18:19 +00:00
|
|
|
src->running_time = gst_util_uint64_scale (src->n_frames,
|
2011-06-21 15:33:27 +00:00
|
|
|
src->info.fps_d * GST_SECOND, src->info.fps_n);
|
2006-03-23 11:18:19 +00:00
|
|
|
} else {
|
|
|
|
/* FIXME : Not sure what to set here */
|
|
|
|
src->running_time = 0;
|
|
|
|
}
|
2005-12-12 15:09:55 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
g_assert (src->running_time <= position);
|
2005-12-12 15:09:55 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_video_test_src_is_seekable (GstBaseSrc * psrc)
|
|
|
|
{
|
|
|
|
/* we're seekable... */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
static GstFlowReturn
|
2011-06-13 10:09:34 +00:00
|
|
|
gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
|
2002-07-26 22:18:57 +00:00
|
|
|
{
|
2005-09-28 13:36:45 +00:00
|
|
|
GstVideoTestSrc *src;
|
2005-12-12 15:09:55 +00:00
|
|
|
GstClockTime next_time;
|
2011-06-21 15:33:27 +00:00
|
|
|
GstVideoFrame frame;
|
2002-07-26 22:18:57 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
src = GST_VIDEO_TEST_SRC (psrc);
|
2004-06-18 22:32:44 +00:00
|
|
|
|
2011-06-16 10:48:33 +00:00
|
|
|
if (G_UNLIKELY (src->format == NULL))
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
goto not_negotiated;
|
2004-06-18 22:32:44 +00:00
|
|
|
|
2006-04-28 14:24:38 +00:00
|
|
|
/* 0 framerate and we are at the second frame, eos */
|
2011-06-21 15:33:27 +00:00
|
|
|
if (G_UNLIKELY (src->info.fps_n == 0 && src->n_frames == 1))
|
2006-04-28 14:24:38 +00:00
|
|
|
goto eos;
|
|
|
|
|
2006-09-18 15:48:01 +00:00
|
|
|
GST_LOG_OBJECT (src,
|
2011-04-29 10:10:14 +00:00
|
|
|
"creating buffer from pool for frame %d", (gint) src->n_frames);
|
2008-07-31 12:58:44 +00:00
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
if (!gst_video_frame_map (&frame, &src->info, buffer, GST_MAP_WRITE))
|
|
|
|
goto invalid_frame;
|
2009-03-28 09:40:43 +00:00
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
src->make_image (src, &frame);
|
2010-09-11 01:10:40 +00:00
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
gst_video_frame_unmap (&frame);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2011-06-13 10:09:34 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
|
|
|
|
GST_BUFFER_OFFSET (buffer) = src->n_frames;
|
2005-09-28 13:36:45 +00:00
|
|
|
src->n_frames++;
|
2011-06-13 10:09:34 +00:00
|
|
|
GST_BUFFER_OFFSET_END (buffer) = src->n_frames;
|
2011-06-21 15:33:27 +00:00
|
|
|
if (src->info.fps_n) {
|
2006-03-23 11:18:19 +00:00
|
|
|
next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
|
2011-06-21 15:33:27 +00:00
|
|
|
src->info.fps_d, src->info.fps_n);
|
2011-06-13 10:09:34 +00:00
|
|
|
GST_BUFFER_DURATION (buffer) = next_time - src->running_time;
|
2006-03-23 11:18:19 +00:00
|
|
|
} else {
|
|
|
|
next_time = src->timestamp_offset;
|
|
|
|
/* NONE means forever */
|
2011-06-13 10:09:34 +00:00
|
|
|
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
|
2006-03-23 11:18:19 +00:00
|
|
|
}
|
2005-12-12 15:09:55 +00:00
|
|
|
|
|
|
|
src->running_time = next_time;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
not_negotiated:
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2005-09-28 13:36:45 +00:00
|
|
|
GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, (NULL),
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
("format wasn't negotiated before get function"));
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2006-04-28 14:24:38 +00:00
|
|
|
eos:
|
|
|
|
{
|
2006-10-05 15:55:21 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
|
2011-10-10 09:39:52 +00:00
|
|
|
return GST_FLOW_EOS;
|
2006-04-28 14:24:38 +00:00
|
|
|
}
|
2011-06-21 15:33:27 +00:00
|
|
|
invalid_frame:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (src, "invalid frame");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
gst/videotestsrc/: Make videotestsrc a pushsrc.
Original commit message from CVS:
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get_type),
(gst_videotestsrc_class_init), (gst_videotestsrc_negotiate),
(gst_videotestsrc_setcaps), (gst_videotestsrc_getcaps),
(gst_videotestsrc_init), (gst_videotestsrc_event),
(gst_videotestsrc_create), (gst_videotestsrc_start),
(gst_videotestsrc_stop), (gst_videotestsrc_get_times),
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
(gst_videotestsrc_get_property):
* gst/videotestsrc/gstvideotestsrc.h:
Make videotestsrc a pushsrc.
2005-07-14 18:42:47 +00:00
|
|
|
}
|
|
|
|
|
2005-12-27 22:29:43 +00:00
|
|
|
static gboolean
|
|
|
|
gst_video_test_src_start (GstBaseSrc * basesrc)
|
|
|
|
{
|
|
|
|
GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (basesrc);
|
|
|
|
|
|
|
|
src->running_time = 0;
|
|
|
|
src->n_frames = 0;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-06-21 15:33:27 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2002-07-26 22:18:57 +00:00
|
|
|
static gboolean
|
2003-11-02 20:48:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2002-07-26 22:18:57 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (video_test_src_debug, "videotestsrc", 0,
|
2005-07-19 12:01:53 +00:00
|
|
|
"Video Test Source");
|
2004-08-04 11:08:13 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return gst_element_register (plugin, "videotestsrc", GST_RANK_NONE,
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_TYPE_VIDEO_TEST_SRC);
|
2002-07-26 22:18:57 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2012-04-05 13:11:05 +00:00
|
|
|
videotestsrc,
|
2004-03-14 22:34:34 +00:00
|
|
|
"Creates a test video stream",
|
2005-10-16 13:54:44 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|