diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-04-03 17:38:53 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-04-07 14:15:36 +0200 |
commit | c271f89d4ae71c45f295ccdaea815809644c3637 (patch) | |
tree | fe15b412fd6b8f41aef000314f439488faed5376 | |
parent | 47f1713f1e7be485c1dfebb3760da1d55da6ade0 (diff) |
ges-launch: Add support for +test-clip
Summary: With the pattern as a mandatory argument.
Reviewers: thiblahute
Differential Revision: http://phabricator.freedesktop.org/D68
-rw-r--r-- | data/completions/ges-launch-1.0 | 16 | ||||
-rw-r--r-- | ges/ges-command-line-formatter.c | 31 | ||||
-rw-r--r-- | ges/ges-structure-parser.c | 2 | ||||
-rw-r--r-- | ges/ges-structured-interface.c | 21 | ||||
-rw-r--r-- | ges/parse.l | 3 | ||||
-rw-r--r-- | tools/ges-launch.c | 3 |
6 files changed, 71 insertions, 5 deletions
diff --git a/data/completions/ges-launch-1.0 b/data/completions/ges-launch-1.0 index 7989a5bf..b93f4529 100644 --- a/data/completions/ges-launch-1.0 +++ b/data/completions/ges-launch-1.0 @@ -66,7 +66,16 @@ _ges_clip () { 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 } @@ -96,6 +105,9 @@ _ges_list_properties () { 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=() @@ -165,7 +177,7 @@ __ges_main () if [[ "$command" == "--gst"* ]]; then completion_func="_${command//-/_}" else - completion_func="_ges_${command//-|+/_}" + completion_func="_ges_${command//-/_}" completion_func="${completion_func//+/}" fi diff --git a/ges/ges-command-line-formatter.c b/ges/ges-command-line-formatter.c index f4ed77ac..0a2fec93 100644 --- a/ges/ges-command-line-formatter.c +++ b/ges/ges-command-line-formatter.c @@ -160,6 +160,30 @@ _ges_command_line_formatter_add_clip (GESTimeline * timeline, } 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) { @@ -197,6 +221,13 @@ static GOptionEntry timeline_parsing_options[] = { "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 * diff --git a/ges/ges-structure-parser.c b/ges/ges-structure-parser.c index 37b530fa..5c276fd5 100644 --- a/ges/ges-structure-parser.c +++ b/ges/ges-structure-parser.c @@ -127,6 +127,8 @@ ges_structure_parser_parse_symbol (GESStructureParser * self, 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)) diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c index a561d80d..59ae0eda 100644 --- a/ges/ges-structured-interface.c +++ b/ges/ges-structured-interface.c @@ -267,6 +267,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, GESClip *clip; gint layer_priority; const gchar *name; + const gchar *pattern; gchar *asset_id = NULL; const gchar *type_string; GType type; @@ -276,7 +277,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, 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 }; @@ -287,6 +288,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, 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); @@ -337,6 +339,23 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, 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; diff --git a/ges/parse.l b/ges/parse.l index a7df14fc..04f533af 100644 --- a/ges/parse.l +++ b/ges/parse.l @@ -11,6 +11,7 @@ %option noinput CLIP [ ]+\+clip[ ]+ +TEST_CLIP [ ]+\+test-clip[ ]+ TRANSITION [ ]+\+transition[ ]+ EFFECT [ ]+\+effect[ ]+ @@ -22,7 +23,7 @@ SETTER [ ]+set-[^ ]+[ ]+ ges_structure_parser_parse_string (yyextra, yytext, FALSE); } -{CLIP}|{TRANSITION}|{EFFECT} { +{CLIP}|{TRANSITION}|{EFFECT}|{TEST_CLIP} { ges_structure_parser_parse_symbol (yyextra, yytext); } diff --git a/tools/ges-launch.c b/tools/ges-launch.c index 56bb1ba8..3eec705f 100644 --- a/tools/ges-launch.c +++ b/tools/ges-launch.c @@ -26,7 +26,8 @@ _print_all_commands (void) { /* 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"); } |