summaryrefslogtreecommitdiff
path: root/thumbnailer
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-14 20:35:58 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:35:58 +0200
commitd443a3c2509889533ca812c163056bace396b586 (patch)
treee94ffc0d9c054ca4efb8fb327e18dfac88e15dc7 /thumbnailer
parentbb9797c14470641b082ebf635e2ae3cfd5f27a3b (diff)
New upstream version 0.32.1upstream/0.32.1
Diffstat (limited to 'thumbnailer')
-rw-r--r--thumbnailer/shotwell-video-thumbnailer.vala21
1 files changed, 16 insertions, 5 deletions
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 <filename> <output> \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);