-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completes #86 bullet point 4 This change refactors how we store the stream variants and also sets up the transcoder for unit tests and cleans up the way transcoder invokes ffmpeg.
- Loading branch information
1 parent
fbd105d
commit c7eccfa
Showing
41 changed files
with
1,537 additions
and
1,532 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#[derive(Debug, Clone, Default)] | ||
pub enum ProtobufValue<T: prost::Message + std::default::Default> { | ||
#[default] | ||
None, | ||
Some(T), | ||
Err(prost::DecodeError), | ||
} | ||
|
||
impl<T: prost::Message + std::default::Default> ProtobufValue<T> { | ||
#[allow(dead_code)] | ||
pub fn unwrap(self) -> Option<T> { | ||
match self { | ||
Self::Some(data) => Some(data), | ||
Self::None => None, | ||
Self::Err(err) => panic!( | ||
"called `ProtobufValue::unwrap()` on a `Err` value: {:?}", | ||
err | ||
), | ||
} | ||
} | ||
} | ||
|
||
impl<T: prost::Message + std::default::Default, F> From<Option<F>> for ProtobufValue<T> | ||
where | ||
ProtobufValue<T>: From<F>, | ||
{ | ||
fn from(data: Option<F>) -> Self { | ||
match data { | ||
Some(data) => Self::from(data), | ||
None => Self::None, | ||
} | ||
} | ||
} | ||
|
||
impl<T: prost::Message + std::default::Default> From<Vec<u8>> for ProtobufValue<T> { | ||
fn from(data: Vec<u8>) -> Self { | ||
match T::decode(data.as_slice()) { | ||
Ok(variants) => Self::Some(variants), | ||
Err(e) => Self::Err(e), | ||
} | ||
} | ||
} | ||
|
||
impl<T: prost::Message + std::default::Default + PartialEq> PartialEq for ProtobufValue<T> { | ||
fn eq(&self, other: &Self) -> bool { | ||
match (self, other) { | ||
(Self::None, Self::None) => true, | ||
(Self::Some(a), Self::Some(b)) => a == b, | ||
_ => false, | ||
} | ||
} | ||
} | ||
|
||
impl<T: prost::Message + std::default::Default + PartialEq> PartialEq<Option<T>> | ||
for ProtobufValue<T> | ||
{ | ||
fn eq(&self, other: &Option<T>) -> bool { | ||
match (self, other) { | ||
(Self::None, None) => true, | ||
(Self::Some(a), Some(b)) => a == b, | ||
_ => false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
pub mod session; | ||
pub mod stream; | ||
pub mod stream_variant; | ||
pub mod user; | ||
pub mod user_permissions; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.