[gegl] gcut: do not overwrite previously generated/edited edl for video files



commit 3bc003f48ea607307e335dedfd52975c8811530f
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jul 16 13:18:08 2017 +0200

    gcut: do not overwrite previously generated/edited edl for video files
    
    Avoiding data loss for workflows where one starts out editing video clips
    directly.

 gcut/gcut.c |   32 ++++++++++++++++++++++++--------
 gcut/gcut.h |    1 +
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/gcut/gcut.c b/gcut/gcut.c
index 5485fe9..0252346 100644
--- a/gcut/gcut.c
+++ b/gcut/gcut.c
@@ -1244,6 +1244,21 @@ static void gcut_start_sanity (void)
 
 gint iconographer_main (gint    argc, gchar **argv);
 
+gint str_has_video_suffix (const gchar *edl_path);
+gint str_has_video_suffix (const gchar *edl_path)
+{
+  if (g_str_has_suffix (edl_path, ".mp4") ||
+      g_str_has_suffix (edl_path, ".ogv") ||
+      g_str_has_suffix (edl_path, ".mkv") ||
+      g_str_has_suffix (edl_path, ".MKV") ||
+      g_str_has_suffix (edl_path, ".avi") ||
+      g_str_has_suffix (edl_path, ".MP4") ||
+      g_str_has_suffix (edl_path, ".OGV") ||
+      g_str_has_suffix (edl_path, ".AVI"))
+    return 1;
+  return 0;
+}
+
 int main (int argc, char **argv)
 {
   GeglEDL *edl = NULL;
@@ -1277,14 +1292,15 @@ int main (int argc, char **argv)
 
   edl_path = argv[1]; //realpath (argv[1], NULL);
 
-  if (g_str_has_suffix (edl_path, ".mp4") ||
-      g_str_has_suffix (edl_path, ".ogv") ||
-      g_str_has_suffix (edl_path, ".mkv") ||
-      g_str_has_suffix (edl_path, ".MKV") ||
-      g_str_has_suffix (edl_path, ".avi") ||
-      g_str_has_suffix (edl_path, ".MP4") ||
-      g_str_has_suffix (edl_path, ".OGV") ||
-      g_str_has_suffix (edl_path, ".AVI"))
+  if (str_has_video_suffix (edl_path))
+  {
+    char * path = realpath (edl_path, NULL);
+    char * rpath = g_strdup_printf ("%s.edl", path);
+    if (g_file_test (rpath, G_FILE_TEST_IS_REGULAR))
+      edl_path = rpath;
+  }
+
+  if (str_has_video_suffix (edl_path))
   {
     char str[1024];
     int duration;
diff --git a/gcut/gcut.h b/gcut/gcut.h
index 99938b9..8074111 100644
--- a/gcut/gcut.h
+++ b/gcut/gcut.h
@@ -25,6 +25,7 @@
         subtitles
 
     ui
+      start using css
       port gcut-ui.c to lua
       detect locked or crashed ui, kill and respawn
       trimming by mouse / dragging clips around by mouse


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]