summaryrefslogtreecommitdiff
path: root/thumbnailer/shotwell-video-thumbnailer.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-28 21:35:52 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-28 21:35:52 +0200
commitb86540b743f1a87a163ffb811c8fe22a01fefa38 (patch)
treeb47cb3bb83c2377234226fb3987ab3320a987dd9 /thumbnailer/shotwell-video-thumbnailer.vala
parentac6e0b731b9f0b2efd392e3309a5c07e2a66adad (diff)
parente905d8e16eec152d19797937f13ba3cf4b8f8aca (diff)
Merge branch 'release/debian/0.32.1-1'debian/0.32.1-1
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);