mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
ges-launch: Add support for +test-clip
Summary: With the pattern as a mandatory argument. Reviewers: thiblahute Differential Revision: http://phabricator.freedesktop.org/D68
This commit is contained in:
parent
47f1713f1e
commit
c271f89d4a
6 changed files with 71 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -94,6 +103,9 @@ _ges_list_properties () {
|
|||
then
|
||||
_gst_mandatory_argument
|
||||
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" ]]
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -159,6 +159,30 @@ _ges_command_line_formatter_add_clip (GESTimeline * timeline,
|
|||
return _ges_add_clip_from_struct (timeline, structure, error);
|
||||
}
|
||||
|
||||
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 *
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue