mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
convert rest of code to use GESVideoTestPattern
This commit is contained in:
parent
e73c98630e
commit
9f71c1ff8c
7 changed files with 15 additions and 89 deletions
|
@ -18,3 +18,4 @@ ges_simple_timeline_layer_get_type
|
|||
ges_video_transition_type_get_type
|
||||
ges_text_valign_get_type
|
||||
ges_text_halign_get_type
|
||||
ges_video_test_pattern_get_type
|
||||
|
|
|
@ -38,46 +38,6 @@
|
|||
G_DEFINE_TYPE (GESTimelineTestSource, ges_timeline_test_source,
|
||||
GES_TYPE_TIMELINE_SOURCE);
|
||||
|
||||
#define GES_TIMELINE_TEST_SOURCE_VPATTERN_TYPE\
|
||||
ges_timeline_test_source_vpattern_get_type()
|
||||
|
||||
/* table more-or-less copied from gstvideotestsrc.c */
|
||||
static GEnumValue vpattern_enum_values[] = {
|
||||
{GES_TRACK_VIDEO_BG_SRC_SMPTE, "SMPTE 100% color bars", "smpte"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_SNOW, "Random (television snow)", "snow"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_BLACK, "100% Black", "black"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_WHITE, "100% White", "white"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_RED, "Red", "red"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_GREEN, "Green", "green"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_BLUE, "Blue", "blue"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_CHECKERS1, "Checkers 1px", "checkers-1"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_CHECKERS2, "Checkers 2px", "checkers-2"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_CHECKERS4, "Checkers 4px", "checkers-4"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_CHECKERS8, "Checkers 8px", "checkers-8"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_CIRCULAR, "Circular", "circular"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_BLINK, "Blink", "blink"},
|
||||
{GES_TRACK_VIDEO_BG_SRC_SMPTE75, "SMPTE 75% color bars", "smpte75"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
GType ges_timeline_test_source_vpattern_get_type (void);
|
||||
|
||||
GType
|
||||
ges_timeline_test_source_vpattern_get_type (void)
|
||||
{
|
||||
|
||||
static gsize once = 0;
|
||||
static GType theType = 0;
|
||||
|
||||
if (g_once_init_enter (&once)) {
|
||||
theType = g_enum_register_static ("GESTimelineTestSourceVPattern",
|
||||
vpattern_enum_values);
|
||||
g_once_init_leave (&once, 1);
|
||||
};
|
||||
|
||||
return theType;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -163,8 +123,8 @@ ges_timeline_test_source_class_init (GESTimelineTestSourceClass * klass)
|
|||
g_object_class_install_property (object_class, PROP_VPATTERN,
|
||||
g_param_spec_enum ("vpattern", "VPattern",
|
||||
"Which video pattern to display. See videotestsrc element",
|
||||
GES_TIMELINE_TEST_SOURCE_VPATTERN_TYPE,
|
||||
GES_TRACK_VIDEO_BG_SRC_BLACK, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
GES_VIDEO_TEST_PATTERN_TYPE,
|
||||
GES_VIDEO_TEST_PATTERN_BLACK, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
/**
|
||||
* GESTimelineTestSource:mute:
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define _GES_TL_TESTSOURCE
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <ges/ges-enums.h>
|
||||
#include <ges/ges-types.h>
|
||||
#include <ges/ges-timeline-source.h>
|
||||
#include <ges/ges-track.h>
|
||||
|
|
|
@ -147,7 +147,7 @@ ges_track_title_src_create_element (GESTrackSource * object)
|
|||
g_object_set (text, "valignment", (gint) self->valign, "halignment",
|
||||
(gint) self->halign, NULL);
|
||||
|
||||
g_object_set (background, "pattern", (gint) GES_TRACK_VIDEO_BG_SRC_BLACK,
|
||||
g_object_set (background, "pattern", (gint) GES_VIDEO_TEST_PATTERN_BLACK,
|
||||
NULL);
|
||||
|
||||
gst_bin_add_many (GST_BIN (topbin), background, text, NULL);
|
||||
|
|
|
@ -69,7 +69,7 @@ ges_track_video_test_source_class_init (GESTrackVideoTestSourceClass * klass)
|
|||
static void
|
||||
ges_track_video_test_source_init (GESTrackVideoTestSource * self)
|
||||
{
|
||||
self->pattern = GES_TRACK_VIDEO_BG_SRC_BLACK;
|
||||
self->pattern = GES_VIDEO_TEST_PATTERN_BLACK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -119,7 +119,7 @@ ges_track_video_test_source_create_element (GESTrackSource * self)
|
|||
|
||||
void
|
||||
ges_track_video_test_source_set_pattern (GESTrackVideoTestSource
|
||||
* self, GESTrackVideoBgSrcPattern pattern)
|
||||
* self, GESVideoTestPattern pattern)
|
||||
{
|
||||
GstElement *element;
|
||||
element = GES_TRACK_SOURCE (self)->element;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define _GES_TRACK_VIDEO_TEST_SOURCE
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <ges/ges-enums.h>
|
||||
#include <ges/ges-types.h>
|
||||
#include <ges/ges-track-source.h>
|
||||
|
||||
|
@ -44,43 +45,6 @@ G_BEGIN_DECLS
|
|||
#define GES_TRACK_VIDEO_TEST_SOURCE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_VIDEO_TEST_SOURCE, GESTrackVideoTestSourceClass))
|
||||
|
||||
/**
|
||||
* GESTrackVideoBgSrcPattern:
|
||||
* @GES_TRACK_VIDEO_BG_SRC_SMPTE: A standard SMPTE test pattern
|
||||
* @GES_TRACK_VIDEO_BG_SRC_SNOW: Random noise
|
||||
* @GES_TRACK_VIDEO_BG_SRC_BLACK: A black image
|
||||
* @GES_TRACK_VIDEO_BG_SRC_WHITE: A white image
|
||||
* @GES_TRACK_VIDEO_BG_SRC_RED: A red image
|
||||
* @GES_TRACK_VIDEO_BG_SRC_GREEN: A green image
|
||||
* @GES_TRACK_VIDEO_BG_SRC_BLUE: A blue image
|
||||
* @GES_TRACK_VIDEO_BG_SRC_CHECKERS1: Checkers pattern (1px)
|
||||
* @GES_TRACK_VIDEO_BG_SRC_CHECKERS2: Checkers pattern (2px)
|
||||
* @GES_TRACK_VIDEO_BG_SRC_CHECKERS4: Checkers pattern (4px)
|
||||
* @GES_TRACK_VIDEO_BG_SRC_CHECKERS8: Checkers pattern (8px)
|
||||
* @GES_TRACK_VIDEO_BG_SRC_CIRCULAR: Circular pattern
|
||||
* @GES_TRACK_VIDEO_BG_SRC_BLINK: Alternate between black and white
|
||||
* @GES_TRACK_VIDEO_BG_SRC_SMPTE75: SMPTE test pattern (75% color bars)
|
||||
*
|
||||
* The test pattern to produce
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
GES_TRACK_VIDEO_BG_SRC_SMPTE,
|
||||
GES_TRACK_VIDEO_BG_SRC_SNOW,
|
||||
GES_TRACK_VIDEO_BG_SRC_BLACK,
|
||||
GES_TRACK_VIDEO_BG_SRC_WHITE,
|
||||
GES_TRACK_VIDEO_BG_SRC_RED,
|
||||
GES_TRACK_VIDEO_BG_SRC_GREEN,
|
||||
GES_TRACK_VIDEO_BG_SRC_BLUE,
|
||||
GES_TRACK_VIDEO_BG_SRC_CHECKERS1,
|
||||
GES_TRACK_VIDEO_BG_SRC_CHECKERS2,
|
||||
GES_TRACK_VIDEO_BG_SRC_CHECKERS4,
|
||||
GES_TRACK_VIDEO_BG_SRC_CHECKERS8,
|
||||
GES_TRACK_VIDEO_BG_SRC_CIRCULAR,
|
||||
GES_TRACK_VIDEO_BG_SRC_BLINK,
|
||||
GES_TRACK_VIDEO_BG_SRC_SMPTE75,
|
||||
} GESTrackVideoBgSrcPattern;
|
||||
|
||||
/**
|
||||
* GESTrackVideoTestSource:
|
||||
* @parent: parent
|
||||
|
@ -89,7 +53,7 @@ struct _GESTrackVideoTestSource {
|
|||
GESTrackSource parent;
|
||||
|
||||
/*< private >*/
|
||||
GESTrackVideoBgSrcPattern pattern;
|
||||
GESVideoTestPattern pattern;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -109,7 +73,7 @@ GESTrackVideoTestSource* ges_track_video_test_source_new (void);
|
|||
void
|
||||
|
||||
ges_track_video_test_source_set_pattern(GESTrackVideoTestSource *,
|
||||
GESTrackVideoBgSrcPattern);
|
||||
GESVideoTestPattern);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ GST_START_TEST (test_test_source_in_layer)
|
|||
GESTrack *a, *v;
|
||||
GESTrackObject *trobj;
|
||||
GESTimelineTestSource *source;
|
||||
GESTrackVideoBgSrcPattern ptrn;
|
||||
GESVideoTestPattern ptrn;
|
||||
|
||||
ges_init ();
|
||||
|
||||
|
@ -130,7 +130,7 @@ GST_START_TEST (test_test_source_in_layer)
|
|||
|
||||
source = ges_timeline_test_source_new_for_nick ((gchar *) "red");
|
||||
g_object_get (source, "vpattern", &ptrn, NULL);
|
||||
assert_equals_int (ptrn, GES_TRACK_VIDEO_BG_SRC_RED);
|
||||
assert_equals_int (ptrn, GES_VIDEO_TEST_PATTERN_RED);
|
||||
|
||||
g_object_set (source, "duration", (guint64) GST_SECOND, NULL);
|
||||
|
||||
|
@ -138,15 +138,15 @@ GST_START_TEST (test_test_source_in_layer)
|
|||
(GESTimelineObject *) source, 0);
|
||||
|
||||
/* specifically test the vpattern property */
|
||||
g_object_set (source, "vpattern", (gint) GES_TRACK_VIDEO_BG_SRC_WHITE, NULL);
|
||||
g_object_set (source, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_WHITE, NULL);
|
||||
g_object_get (source, "vpattern", &ptrn, NULL);
|
||||
assert_equals_int (ptrn, GES_TRACK_VIDEO_BG_SRC_WHITE);
|
||||
assert_equals_int (ptrn, GES_VIDEO_TEST_PATTERN_WHITE);
|
||||
|
||||
trobj =
|
||||
ges_timeline_object_find_track_object (GES_TIMELINE_OBJECT (source), v);
|
||||
|
||||
ptrn = ((GESTrackVideoTestSource *) trobj)->pattern;
|
||||
assert_equals_int (ptrn, GES_TRACK_VIDEO_BG_SRC_WHITE);
|
||||
assert_equals_int (ptrn, GES_VIDEO_TEST_PATTERN_WHITE);
|
||||
|
||||
GST_DEBUG ("removing the source");
|
||||
|
||||
|
|
Loading…
Reference in a new issue