add support for ugoira

add progress bar
This commit is contained in:
2022-03-19 17:14:53 +08:00
parent 8ef00def87
commit 0ddcd7d533
31 changed files with 1823 additions and 175 deletions

35
src/ext/json.rs Normal file
View File

@@ -0,0 +1,35 @@
use json::JsonValue;
pub trait ToJson {
fn to_json(&self) -> Option<JsonValue>;
}
impl ToJson for &str {
fn to_json(&self) -> Option<JsonValue> {
Some(JsonValue::String(String::from(*self)))
}
}
impl ToJson for &String {
fn to_json(&self) -> Option<JsonValue> {
Some(JsonValue::String((*self).to_string()))
}
}
impl ToJson for String {
fn to_json(&self) -> Option<JsonValue> {
Some(JsonValue::String(self.to_string()))
}
}
impl ToJson for JsonValue {
fn to_json(&self) -> Option<JsonValue> {
Some(self.clone())
}
}
impl ToJson for &JsonValue {
fn to_json(&self) -> Option<JsonValue> {
Some((*self).clone())
}
}

View File

@@ -1,5 +1,6 @@
pub mod cstr;
#[cfg(feature = "flagset")]
pub mod flagset;
#[cfg(any(feature = "exif", feature = "avdict"))]
pub mod json;
#[cfg(any(feature = "exif", feature = "avdict", feature = "ugoira"))]
pub mod rawhandle;

View File

@@ -2,4 +2,9 @@
pub trait ToRawHandle<T> {
/// Return raw pointer of the handle
unsafe fn to_raw_handle(&self) -> *mut T;
/// Return the const raw pointer of the handle
unsafe fn to_const_handle(&self) -> *const T {
self.to_raw_handle() as *const T
}
}