summaryrefslogtreecommitdiff
path: root/thumbnailer/shotwell-video-thumbnailer.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
commit31804433d72460cbe0a39f9f8ea5e76058d84cda (patch)
tree2084a84c39f159c6aea254775dc0880d52579d45 /thumbnailer/shotwell-video-thumbnailer.vala
parenta9898fb3f39c44a85876930ef6b2558052569ae6 (diff)
parentd443a3c2509889533ca812c163056bace396b586 (diff)
Update upstream source from tag 'upstream/0.32.1'
Update to upstream version '0.32.1' with Debian dir c460ad6e13d3c39eaa2d5399059385e64e6fba4c
Diffstat (limited to 'thumbnailer/shotwell-video-thumbnailer.vala')
-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);