From d443a3c2509889533ca812c163056bace396b586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 14 Jun 2023 20:35:58 +0200 Subject: New upstream version 0.32.1 --- thumbnailer/shotwell-video-thumbnailer.vala | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'thumbnailer') diff --git a/thumbnailer/shotwell-video-thumbnailer.vala b/thumbnailer/shotwell-video-thumbnailer.vala index db5a096..5974934 100644 --- a/thumbnailer/shotwell-video-thumbnailer.vala +++ b/thumbnailer/shotwell-video-thumbnailer.vala @@ -19,6 +19,21 @@ class ShotwellThumbnailer { uint8[]? pngdata; int64 duration, position; Gst.StateChangeReturn ret; + OutputStream out; + + if (args.length != 3) { + stdout.printf("usage: %s \n Writes video thumbnail to output\n", args[0]); + return 1; + } + + var out_file = File.new_for_commandline_arg (args[2]); + try { + out = out_file.append_to(FileCreateFlags.NONE); + debug("Writing thumbnail to %s", args[2]); + } catch (Error err) { + warning("Failed to append to image file %s", err.message); + return 1; + } if (Posix.nice (19) < 0) { debug ("Failed to reduce thumbnailer nice level. Continuing anyway"); @@ -36,10 +51,6 @@ class ShotwellThumbnailer { registry.remove_feature (feature); } - if (args.length != 2) { - stdout.printf("usage: %s [filename]\n Writes video thumbnail to stdout\n", args[0]); - return 1; - } descr = "playbin uri=\"%s\" audio-sink=fakesink video-sink=\"gdkpixbufsink name=sink\"".printf(File.new_for_commandline_arg(args[1]).get_uri()); @@ -120,7 +131,7 @@ class ShotwellThumbnailer { pixbuf = pixbuf.rotate_simple(direction); } pixbuf.save_to_buffer(out pngdata, "png"); - stdout.write(pngdata); + out.write(pngdata); // cleanup and exit. pipeline.set_state(Gst.State.NULL); -- cgit v1.2.3