Prechádzať zdrojové kódy

Updates for LibInvercargill changes

Billy Barrow 1 mesiac pred
rodič
commit
4ebcea1994
3 zmenil súbory, kde vykonal 17 pridanie a 16 odobranie
  1. 10 7
      src/Application.vala
  2. 3 3
      src/EncodingProfile.vala
  3. 4 6
      src/Vp9Profiles.vala

+ 10 - 7
src/Application.vala

@@ -1,11 +1,14 @@
+using Invercargill;
+using Invercargill.DataStructures;
+
 namespace Webmify {
 
     static string watch_dir;
     static string output_dir;
     static string work_dir;
     static uint workers;
-    static Invercargill.Set<string> processed_files;
-    static Invercargill.Fifo<string> queue;
+    static HashSet<string> processed_files;
+    static Fifo<string> queue;
 
     public static int main(string[] argv) {
         if(argv.length != 4 && argv.length != 5) {
@@ -26,8 +29,8 @@ namespace Webmify {
             return -2;
         }
 
-        processed_files = new Invercargill.Set<string>();
-        queue = new Invercargill.Fifo<string>();
+        processed_files = new HashSet<string>();
+        queue = new Fifo<string>();
 
         // Start the watcher
         new Thread<bool>("watcher", watch_directory);
@@ -79,9 +82,9 @@ namespace Webmify {
     private static bool watch_directory() {
 
         while(true) {
-            var files = Invercargill.directory(watch_dir).to_set();
-            files.remove_all(processed_files);
-            processed_files.add_all(files);
+            var files = Iterate.directory(watch_dir).to_hash_set();
+            files.except_with(processed_files);
+            processed_files.union_with(files);
             foreach (var file in files) {
                 print(@"[Webmify] Adding file \"$file\" to queue.\n");
                 var path = Path.build_filename(watch_dir, file);

+ 3 - 3
src/EncodingProfile.vala

@@ -33,14 +33,14 @@ namespace Webmify {
         var vp9_360 = new Vp9Video360pProfile();
         var vp9_240 = new Vp9Video240pProfile();
 
-        return Invercargill.Convert.ate(new EncodingProfile[] {
+        return Invercargill.Iterate.these<EncodingProfile>(
             new Vp9Video1080pHighFramerateProfile (),
             new Vp9Video1080pLowFramerateProfile (),
             vp9_720,
             vp9_480,
             vp9_360,
-            vp9_240,
-        });
+            vp9_240
+        );
     }
 
 }

+ 4 - 6
src/Vp9Profiles.vala

@@ -16,12 +16,11 @@ namespace Webmify {
             return @"1080p $(get_clean_fps(fps))fps";
         }
         public override bool suitable_for (VideoInfo info) {
-            return info.height >= 1080 && get_low_framerate (info.frame_rate) != info.frame_rate;
+            return (info.height >= 1080 || info.width >= 1920) && get_low_framerate (info.frame_rate) != info.frame_rate;
         }
         public override void setup_for (VideoInfo info) {
             codec_names = "vp9, opus";
-            var width = (int) (info.ratio_frac * 1080);
-            size = @"$(width)x1080";
+            size = @"$(info.width)x$(info.height)";
             fps = info.frame_rate;
         }
 
@@ -78,12 +77,11 @@ namespace Webmify {
             return @"1080p";
         }
         public override bool suitable_for (VideoInfo info) {
-            return info.height >= 1080;
+            return info.height >= 1080 || info.width >= 1920;
         }
         public override void setup_for (VideoInfo info) {
             codec_names = "vp9, opus";
-            var width = (int) (info.ratio_frac * 1080);
-            size = @"$(width)x1080";
+            size = @"$(info.width)x$(info.height)";
             fps = get_low_framerate (info.frame_rate);
         }