mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 16:51:10 +00:00
use ges_timeline_background_source_new_for_nick when creating pattern sources
This commit is contained in:
parent
7370d3ab7c
commit
440242810c
1 changed files with 4 additions and 41 deletions
|
@ -36,24 +36,6 @@ GESTimelinePipeline *pipeline = NULL;
|
||||||
/* create a table of a subset of the test patterns available from videotestsrc
|
/* create a table of a subset of the test patterns available from videotestsrc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _pattern
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
int value;
|
|
||||||
} pattern;
|
|
||||||
|
|
||||||
pattern patterns[] = {
|
|
||||||
{"smpte", 0},
|
|
||||||
{"snow", 1},
|
|
||||||
{"black", 2},
|
|
||||||
{"white", 3},
|
|
||||||
{"red", 4},
|
|
||||||
{"green", 5},
|
|
||||||
{"blue", 6},
|
|
||||||
};
|
|
||||||
|
|
||||||
int pattern_for_name (char *name);
|
|
||||||
|
|
||||||
gboolean pattern_source_fill_func (GESTimelineObject * object, GESTrackObject
|
gboolean pattern_source_fill_func (GESTimelineObject * object, GESTrackObject
|
||||||
* trobject, GstElement * gnlobj, gpointer user_data);
|
* trobject, GstElement * gnlobj, gpointer user_data);
|
||||||
|
|
||||||
|
@ -69,25 +51,8 @@ guint64 str_to_time (char *time);
|
||||||
|
|
||||||
void print_pattern_list (void);
|
void print_pattern_list (void);
|
||||||
|
|
||||||
#define N_PATTERNS 7
|
|
||||||
#define INVALID_PATTERN -1
|
|
||||||
|
|
||||||
/* and a function to get the pattern for the source */
|
/* and a function to get the pattern for the source */
|
||||||
|
|
||||||
int
|
|
||||||
pattern_for_name (char *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < N_PATTERNS; i++) {
|
|
||||||
if (!g_strcmp0 (patterns[i].name, name)) {
|
|
||||||
return patterns[i].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return INVALID_PATTERN;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
pattern_source_fill_func (GESTimelineObject * object,
|
pattern_source_fill_func (GESTimelineObject * object,
|
||||||
GESTrackObject * trobject, GstElement * gnlobj, gpointer user_data)
|
GESTrackObject * trobject, GstElement * gnlobj, gpointer user_data)
|
||||||
|
@ -215,18 +180,16 @@ create_timeline (int nbargs, gchar ** argv)
|
||||||
for (i = 0; i < nbargs / 3; i++) {
|
for (i = 0; i < nbargs / 3; i++) {
|
||||||
GESTimelineObject *obj;
|
GESTimelineObject *obj;
|
||||||
|
|
||||||
int pattern;
|
|
||||||
|
|
||||||
char *source = argv[i * 3];
|
char *source = argv[i * 3];
|
||||||
char *arg0 = argv[(i * 3) + 1];
|
char *arg0 = argv[(i * 3) + 1];
|
||||||
guint64 duration = str_to_time (argv[(i * 3) + 2]);
|
guint64 duration = str_to_time (argv[(i * 3) + 2]);
|
||||||
|
|
||||||
if (!g_strcmp0 ("+pattern", source)) {
|
if (!g_strcmp0 ("+pattern", source)) {
|
||||||
pattern = pattern_for_name (arg0);
|
obj = GES_TIMELINE_OBJECT (ges_timeline_background_source_new_for_nick
|
||||||
if (pattern == INVALID_PATTERN)
|
(arg0));
|
||||||
g_error ("%d invalid pattern!", pattern);
|
if (!obj)
|
||||||
|
g_error ("%s invalid pattern!", arg0);
|
||||||
|
|
||||||
obj = pattern_source_new (pattern);
|
|
||||||
g_object_set (G_OBJECT (obj), "duration", duration, NULL);
|
g_object_set (G_OBJECT (obj), "duration", duration, NULL);
|
||||||
|
|
||||||
g_print ("Adding <pattern:%s> duration %" GST_TIME_FORMAT "\n",
|
g_print ("Adding <pattern:%s> duration %" GST_TIME_FORMAT "\n",
|
||||||
|
|
Loading…
Reference in a new issue