1 /* GStreamer Editing Services
2 * Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
3 * 2010 Nokia Corporation
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 * SECTION:ges-video-test-source
23 * @short_description: produce solid colors and patterns
26 #include "ges-internal.h"
27 #include "ges-track-element.h"
28 #include "ges-video-test-source.h"
30 G_DEFINE_TYPE (GESVideoTestSource, ges_video_test_source, GES_TYPE_SOURCE);
32 #define DEFAULT_VPATTERN GES_VIDEO_TEST_PATTERN_SMPTE
34 struct _GESVideoTestSourcePrivate
36 GESVideoTestPattern pattern;
39 static GstElement *ges_video_test_source_create_element (GESTrackElement *
43 ges_video_test_source_class_init (GESVideoTestSourceClass * klass)
45 GESTrackElementClass *track_element_class = GES_TRACK_ELEMENT_CLASS (klass);
47 g_type_class_add_private (klass, sizeof (GESVideoTestSourcePrivate));
49 track_element_class->create_element = ges_video_test_source_create_element;
53 ges_video_test_source_init (GESVideoTestSource * self)
55 self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
56 GES_TYPE_VIDEO_TEST_SOURCE, GESVideoTestSourcePrivate);
58 self->priv->pattern = DEFAULT_VPATTERN;
62 ges_video_test_source_create_element (GESTrackElement * self)
69 pattern = ((GESVideoTestSource *) self)->priv->pattern;
72 ("videotestsrc pattern=%i name=testsrc ! capsfilter caps=video/x-raw",
74 ret = gst_parse_bin_from_description (bin_desc, TRUE, NULL);
81 * ges_video_test_source_set_pattern:
82 * @self: a #GESVideoTestSource
83 * @pattern: a #GESVideoTestPattern
85 * Sets the source to use the given @pattern.
88 ges_video_test_source_set_pattern (GESVideoTestSource
89 * self, GESVideoTestPattern pattern)
92 ges_track_element_get_element (GES_TRACK_ELEMENT (self));
94 self->priv->pattern = pattern;
97 gst_child_proxy_set (GST_CHILD_PROXY (element), "testsrc::pattern",
98 (gint) pattern, NULL);
102 * ges_video_test_source_get_pattern:
103 * @source: a #GESVideoTestPattern
105 * Get the video pattern used by the @source.
107 * Returns: The video pattern used by the @source.
110 ges_video_test_source_get_pattern (GESVideoTestSource * source)
112 return source->priv->pattern;
116 * ges_video_test_source_new:
118 * Creates a new #GESVideoTestSource.
120 * Returns: The newly created #GESVideoTestSource, or %NULL if there was an
124 ges_video_test_source_new (void)
126 return g_object_new (GES_TYPE_VIDEO_TEST_SOURCE, "track-type",
127 GES_TRACK_TYPE_VIDEO, NULL);