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 --- src/video-support/VideoSourceCollection.vala | 175 +++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/video-support/VideoSourceCollection.vala (limited to 'src/video-support/VideoSourceCollection.vala') diff --git a/src/video-support/VideoSourceCollection.vala b/src/video-support/VideoSourceCollection.vala new file mode 100644 index 0000000..89daad3 --- /dev/null +++ b/src/video-support/VideoSourceCollection.vala @@ -0,0 +1,175 @@ +/* Copyright 2016 Software Freedom Conservancy Inc. + * + * This software is licensed under the GNU LGPL (version 2.1 or later). + * See the COPYING file in this distribution. + */ + +public class VideoSourceCollection : MediaSourceCollection { + public enum State { + UNKNOWN, + ONLINE, + OFFLINE, + TRASH + } + + public override TransactionController transaction_controller { + get { + if (_transaction_controller == null) + _transaction_controller = new MediaSourceTransactionController(this); + + return _transaction_controller; + } + } + + private TransactionController _transaction_controller = null; + private Gee.MultiMap filesize_to_video = + new Gee.TreeMultiMap(uint64_compare); + + public VideoSourceCollection() { + base("VideoSourceCollection", get_video_key); + + get_trashcan().contents_altered.connect(on_trashcan_contents_altered); + get_offline_bin().contents_altered.connect(on_offline_contents_altered); + } + + protected override MediaSourceHoldingTank create_trashcan() { + return new MediaSourceHoldingTank(this, is_video_trashed, get_video_key); + } + + protected override MediaSourceHoldingTank create_offline_bin() { + return new MediaSourceHoldingTank(this, is_video_offline, get_video_key); + } + + public override MediaMonitor create_media_monitor(Workers workers, Cancellable cancellable) { + return new VideoMonitor(cancellable); + } + + public override bool holds_type_of_source(DataSource source) { + return source is Video; + } + + public override string get_typename() { + return Video.TYPENAME; + } + + public override bool is_file_recognized(File file) { + return VideoReader.is_supported_video_file(file); + } + + private void on_trashcan_contents_altered(Gee.Collection? added, + Gee.Collection? removed) { + trashcan_contents_altered((Gee.Collection