[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    gst-editing-services: =?UTF-8?Q?ges=2Dlauncher=3A=20Add=20sup?= =?UTF-8?Q?port=20for=20titles?=
From:       tsaunier () kemper ! freedesktop ! org (Thibault Saunier)
Date:       2018-03-30 21:31:39
Message-ID: 20180330213139.AB38F76161 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-editing-services
Branch: master
Commit: 6d67debc108dd839f564bbb62f68c5ef2a1a9f3e
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=6d67debc108dd839f564bbb62f68c5ef2a1a9f3e


Author: Thibault Saunier <tsaunier@igalia.com>
Date:   Fri Mar 30 18:17:13 2018 -0300

ges-launcher: Add support for titles

---

 ges/ges-command-line-formatter.c | 53 ++++++++++++++++++++++++++++++++++++++++
 ges/ges-structure-parser.c       |  2 ++
 ges/ges-structured-interface.c   |  8 +++++-
 ges/parse.l                      |  3 ++-
 4 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/ges/ges-command-line-formatter.c b/ges/ges-command-line-formatter.c
index c313a3df..7cef5e50 100644
--- a/ges/ges-command-line-formatter.c
+++ b/ges/ges-command-line-formatter.c
@@ -44,6 +44,9 @@ _ges_command_line_formatter_add_effect (GESTimeline * timeline,
 static gboolean
 _ges_command_line_formatter_add_test_clip (GESTimeline * timeline,
     GstStructure * structure, GError ** error);
+static gboolean
+_ges_command_line_formatter_add_title_clip (GESTimeline * timeline,
+    GstStructure * structure, GError ** error);
 
 typedef struct
 {
@@ -152,6 +155,40 @@ static GESCommandLineOption options[] = {
       {NULL, 0, 0, NULL, FALSE},
     },
   },
+  {"title", 'c', (ActionFromStructureFunc) \
_ges_command_line_formatter_add_title_clip, +    "<title text> - Adds a clip in the \
timeline.", +    {
+      {
+        "text", "n", 0, NULL,
+        "The text to be used as title."
+      },
+      {
+        "name", "n", 0, NULL,
+        "The name of the clip, can be used as an ID later."
+      },
+      {
+        "start", "s",GST_TYPE_CLOCK_TIME, NULL,
+        "The starting position of the clip in the timeline."
+      },
+      {
+        "duration", "d", GST_TYPE_CLOCK_TIME, NULL,
+        "The duration of the clip."
+      },
+      {
+        "inpoint", "i", GST_TYPE_CLOCK_TIME, NULL,
+        "The inpoint of the clip (time in the input file to start playing from)."
+      },
+      {
+        "track-types", "tt", 0, NULL,
+        "The type of the tracks where the clip should be used (audio or video or \
audio+video)." +      },
+      {
+        "layer", "l", 0, NULL,
+        "The priority of the layer into which the clip should be added."
+      },
+      {NULL, 0, 0, NULL, FALSE},
+    },
+  },
   {
     "set-", 0, NULL,
     "<property name> <value> - Set a property on the last added element.\n"
@@ -170,6 +207,7 @@ typedef enum
   CLIP,
   EFFECT,
   TEST_CLIP,
+  TITLE,
   SET,
 } GESCommandLineOptionType;
 
@@ -294,6 +332,21 @@ _ges_command_line_formatter_add_test_clip (GESTimeline * \
timeline,  }
 
 static gboolean
+_ges_command_line_formatter_add_title_clip (GESTimeline * timeline,
+    GstStructure * structure, GError ** error)
+{
+  if (!_cleanup_fields (options[TEST_CLIP].properties, structure, error))
+    return FALSE;
+
+  gst_structure_set (structure, "type", G_TYPE_STRING, "GESTitleClip", NULL);
+  gst_structure_set (structure, "asset-id", G_TYPE_STRING, "GESTitleClip",
+      NULL);
+  GST_ERROR ("Structure: %" GST_PTR_FORMAT, structure);
+
+  return _ges_add_clip_from_struct (timeline, structure, error);
+}
+
+static gboolean
 _ges_command_line_formatter_add_effect (GESTimeline * timeline,
     GstStructure * structure, GError ** error)
 {
diff --git a/ges/ges-structure-parser.c b/ges/ges-structure-parser.c
index 8acb0480..ae05622b 100644
--- a/ges/ges-structure-parser.c
+++ b/ges/ges-structure-parser.c
@@ -128,6 +128,8 @@ ges_structure_parser_parse_symbol (GESStructureParser * self,
     ges_structure_parser_parse_string (self, "effect, bin-description=", TRUE);
   else if (!g_ascii_strncasecmp (symbol, "transition", 10))
     ges_structure_parser_parse_string (self, "transition, type=", TRUE);
+  else if (!g_ascii_strncasecmp (symbol, "title", 5))
+    ges_structure_parser_parse_string (self, "title, text=(string)", TRUE);
 }
 
 void
diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c
index 1ebe72b3..1e00a3da 100644
--- a/ges/ges-structured-interface.c
+++ b/ges/ges-structured-interface.c
@@ -328,6 +328,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * \
structure,  GESClip *clip;
   gint layer_priority;
   const gchar *name;
+  const gchar *text;
   const gchar *pattern;
   gchar *asset_id = NULL;
   gchar *check_asset_id = NULL;
@@ -340,7 +341,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * \
structure,  
   const gchar *valid_fields[] =
       { "asset-id", "pattern", "name", "layer-priority", "layer", "type",
-    "start", "inpoint", "duration", NULL
+    "start", "inpoint", "duration", "text", NULL
   };
 
   FieldsError fields_error = { valid_fields, NULL };
@@ -351,6 +352,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * \
structure,  GET_AND_CHECK ("asset-id", G_TYPE_STRING, &check_asset_id, beach);
 
   TRY_GET_STRING ("pattern", &pattern, NULL);
+  TRY_GET_STRING ("text", &text, NULL);
   TRY_GET_STRING ("name", &name, NULL);
   TRY_GET ("layer-priority", G_TYPE_INT, &layer_priority, -1);
   if (layer_priority == -1)
@@ -423,6 +425,10 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure \
* structure,  }
     }
 
+    if (GES_IS_TITLE_CLIP (clip) && text)
+      ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT (clip),
+          "text", text, NULL);
+
     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 b846f408..1581d940 100644
--- a/ges/parse.l
+++ b/ges/parse.l
@@ -15,6 +15,7 @@ CLIP 		[ ]+\+clip[ ]+
 TEST_CLIP       [ ]+\+test-clip[ ]+
 TRANSITION	[ ]+\+transition[ ]+
 EFFECT		[ ]+\+effect[ ]+
+TITLE		[ ]+\+title[ ]+
 
 SETTER		[ ]+set-[^ ]+[ ]+
 
@@ -24,7 +25,7 @@ SETTER		[ ]+set-[^ ]+[ ]+
 		ges_structure_parser_parse_string (yyextra, yytext, FALSE);
 }
 
-{CLIP}|{TRANSITION}|{EFFECT}|{TEST_CLIP}   {
+{CLIP}|{TRANSITION}|{EFFECT}|{TEST_CLIP}|{TITLE}   {
 		ges_structure_parser_parse_symbol (yyextra, yytext);
 }
 

_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic