Summary: With the pattern as a mandatory argument.
Reviewers: thiblahute
Differential Revision: http://phabricator.freedesktop.org/D68
then
_gst_mandatory_argument
else
- COMPREPLY=( $(compgen -W "duration= inpoint= start= layer= $(ges-launch-1.0 help all | egrep '^ [a-zA-Z0-9]')" -- $cur) )
+ COMPREPLY=( $(compgen -W "duration= inpoint= start= layer= $(ges-launch-1.0 help all | egrep '^ +')" -- $cur) )
+ fi
+}
+
+_ges_test_clip () {
+ if [[ "$prev" == "$command" ]];
+ then
+ _gst_mandatory_argument
+ else
+ COMPREPLY=( $(compgen -W "duration= inpoint= start= layer= $(ges-launch-1.0 help all | egrep '^ +')" -- $cur) )
fi
}
elif [[ "$real_command" == "+clip" ]]
then
COMPREPLY=( $(compgen -W "set-alpha set-posx set-posy set-width set-height set-volume set-mute" -- $cur) )
+ elif [[ "$real_command" == "+test-clip" ]]
+ then
+ COMPREPLY=( $(compgen -W "set-alpha set-posx set-posy set-width set-height set-volume set-mute" -- $cur) )
elif [[ "$real_command" == "+effect" ]]
then
COMPREPLY=()
if [[ "$command" == "--gst"* ]]; then
completion_func="_${command//-/_}"
else
- completion_func="_ges_${command//-|+/_}"
+ completion_func="_ges_${command//-/_}"
completion_func="${completion_func//+/}"
fi
}
static gboolean
+_ges_command_line_formatter_add_test_clip (GESTimeline * timeline,
+ GstStructure * structure, GError ** error)
+{
+ const Properties field_names[] = {
+ {"pattern", "p", G_TYPE_STRING, NULL},
+ {"name", "n", 0, NULL},
+ {"start", "s", GST_TYPE_CLOCK_TIME, NULL},
+ {"duration", "d", GST_TYPE_CLOCK_TIME, NULL},
+ {"inpoint", "i", GST_TYPE_CLOCK_TIME, NULL},
+ {"layer", "l", 0, NULL},
+ {NULL, 0, 0, NULL},
+ };
+
+ if (!_cleanup_fields (field_names, structure, error))
+ return FALSE;
+
+ gst_structure_set (structure, "type", G_TYPE_STRING, "GESTestClip", NULL);
+ gst_structure_set (structure, "asset-id", G_TYPE_STRING,
+ gst_structure_get_string (structure, "pattern"), NULL);
+
+ return _ges_add_clip_from_struct (timeline, structure, error);
+}
+
+static gboolean
_ges_command_line_formatter_add_effect (GESTimeline * timeline,
GstStructure * structure, GError ** error)
{
"Adds an effect as specified by 'bin-description'\n"
" * bin-description - d: The description of the effect bin with a gst-launch-style pipeline description.\n"
" * element-name - e : The name of the element to apply the effect on.\n"},
+ {"test-clip", 0, 0.0, G_OPTION_ARG_CALLBACK,
+ &_ges_command_line_formatter_add_test_clip,
+ "",
+ "Add a test clip in the timeline\n"
+ " * start -s : The start position of the element inside the layer.\n"
+ " * duration -d : The duration of the clip."
+ " * inpoint - i : The inpoint of the clip.\n"},
};
GOptionGroup *
self->add_comma = FALSE;
if (!g_ascii_strncasecmp (symbol, "clip", 4))
ges_structure_parser_parse_string (self, "clip, uri=", TRUE);
+ else if (!g_ascii_strncasecmp (symbol, "test-clip", 9))
+ ges_structure_parser_parse_string (self, "test-clip, pattern=", TRUE);
else if (!g_ascii_strncasecmp (symbol, "effect", 6))
ges_structure_parser_parse_string (self, "effect, bin-description=", TRUE);
else if (!g_ascii_strncasecmp (symbol, "transition", 10))
GESClip *clip;
gint layer_priority;
const gchar *name;
+ const gchar *pattern;
gchar *asset_id = NULL;
const gchar *type_string;
GType type;
GST_CLOCK_TIME_NONE;
const gchar *valid_fields[] =
- { "asset-id", "name", "layer-priority", "layer", "type",
+ { "asset-id", "pattern", "name", "layer-priority", "layer", "type",
"start", "inpoint", "duration", NULL
};
GET_AND_CHECK ("asset-id", G_TYPE_STRING, &asset_id);
+ TRY_GET ("pattern", G_TYPE_STRING, &pattern, NULL);
TRY_GET ("name", G_TYPE_STRING, &name, NULL);
TRY_GET ("layer-priority", G_TYPE_INT, &layer_priority, -1);
TRY_GET ("layer", G_TYPE_INT, &layer_priority, -1);
if (clip) {
res = TRUE;
+
+ if (GES_IS_TEST_CLIP (clip)) {
+ if (pattern) {
+ GEnumClass *enum_class =
+ G_ENUM_CLASS (g_type_class_ref (GES_VIDEO_TEST_PATTERN_TYPE));
+ GEnumValue *value = g_enum_get_value_by_nick (enum_class, pattern);
+
+ if (!value) {
+ res = FALSE;
+ goto beach;
+ }
+
+ ges_test_clip_set_vpattern (GES_TEST_CLIP (clip), value->value);
+ g_type_class_unref (enum_class);
+ }
+ }
+
if (name
&& !ges_timeline_element_set_name (GES_TIMELINE_ELEMENT (clip), name)) {
res = FALSE;
%option noinput
CLIP [ ]+\+clip[ ]+
+TEST_CLIP [ ]+\+test-clip[ ]+
TRANSITION [ ]+\+transition[ ]+
EFFECT [ ]+\+effect[ ]+
ges_structure_parser_parse_string (yyextra, yytext, FALSE);
}
-{CLIP}|{TRANSITION}|{EFFECT} {
+{CLIP}|{TRANSITION}|{EFFECT}|{TEST_CLIP} {
ges_structure_parser_parse_symbol (yyextra, yytext);
}
{
/* Yeah I know very fancy */
g_print ("Available ges-launch-1.0 commands:\n\n");
- g_print (" %-9s %-11s %-10s\n\n", "+clip", "+effect", "set-");
+ g_print (" %-9s %-11s %-15s %-10s\n\n", "+clip", "+effect", "+test-clip",
+ "set-");
g_print ("See ges-launch-1.0 help <command> or ges-launch-1.0 help <guide> "
"to read about a specific command or a given guide\n");
}