kplayer_rust_wrap/kplayer/plugin/
mod.rs1#[derive(Copy, Clone)]
2#[allow(dead_code)]
3pub enum MediaType {
4 MediaTypeNone,
5 MediaTypeVideo,
6 MediaTypeAudio,
7}
8
9pub enum InstanceType {
10 InstanceTypeSide,
11 InstanceTypeLink,
12}
13
14#[derive(Copy, Clone)]
15#[allow(dead_code)]
16pub struct Timer {
17 tid: i32,
18 milliseconds: i32,
19}
20impl Timer {
21 pub fn get_tid(&self) -> i32 {
22 self.tid
23 }
24 pub fn get_milliseconds(&self) -> i32 {
25 self.milliseconds
26 }
27 pub fn new(_tid: i32, _milliseconds: i32) -> Self {
28 Timer {
29 tid: _tid,
30 milliseconds: _milliseconds,
31 }
32 }
33}
34
35pub trait BasePlugin {
36 fn get_name(&self) -> String;
38
39 fn get_author(&self) -> String;
41
42 fn get_args(&mut self, args: std::collections::HashMap<String, String>) -> Vec<String>;
44
45 fn get_allow_custom_args(&self) -> Vec<&'static str> {
47 let vec: Vec<&'static str> = Vec::new();
48 vec
49 }
50
51 fn get_filter_name(&self) -> String;
53
54 fn get_media_type(&self) -> MediaType;
56
57 fn validate_user_args(
59 &mut self,
60 args: std::collections::HashMap<String, String>,
61 ) -> Result<bool, &'static str>;
62
63 fn print_log(&self, level: super::util::os::PrintLogLevel, log: &str) {
65 super::util::os::print_log(level, &format!("[{}] {}", self.get_name(), log).to_string())
66 }
67
68 fn register_task(&self) -> Vec<Timer> {
70 let empty: Vec<Timer> = Vec::new();
71 empty
72 }
73
74 fn register_message_keys(&self) -> Vec<super::proto::keys::EventMessageAction> {
76 let empty: Vec<super::proto::keys::EventMessageAction> = Vec::new();
77 empty
78 }
79
80 #[warn(unused_variables)]
82 fn execute_task(&mut self, _tid: u32) {}
83
84 #[allow(unused_variables)]
86 fn execute_message(&mut self, action: i32, body: String) {}
87
88 #[allow(unused_variables)]
90 fn get_instance_type(&mut self) -> InstanceType {
91 InstanceType::InstanceTypeLink
92 }
93
94 #[allow(unused_variables)]
96 fn hook_created(&mut self) -> i32 {
97 0
98 }
99}