diff --git a/flv/src/header.rs b/flv/src/header.rs index b99503da4..0db382416 100644 --- a/flv/src/header.rs +++ b/flv/src/header.rs @@ -3,14 +3,14 @@ use bitflags::bitflags; use std::io::{Seek, SeekFrom}; bitflags! { - #[derive(PartialEq, Eq, Debug)] + #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub struct TypeFlags: u8 { const HAS_AUDIO = 0b1000_0000; const HAS_VIDEO = 0b0010_0000; } } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone)] pub struct Header { pub version: u8, pub type_flags: TypeFlags, diff --git a/flv/src/script.rs b/flv/src/script.rs index 8d790f397..71592213e 100644 --- a/flv/src/script.rs +++ b/flv/src/script.rs @@ -11,7 +11,7 @@ fn parse_string<'a>(reader: &mut FlvReader<'a>, is_long_string: bool) -> Option< } #[repr(u8)] -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone)] pub enum Value<'a> { Number(f64) = 0, Boolean(bool) = 1, @@ -103,7 +103,7 @@ impl<'a> Value<'a> { /// This corresponds to both the `SCRIPTDATAOBJECT` and `SCRIPTDATAVARIABLE` /// structures as defined in the FLV specification. These structures are /// otherwise identical. -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone)] pub struct Variable<'a> { pub name: &'a [u8], pub data: Value<'a>, @@ -118,7 +118,7 @@ impl<'a> Variable<'a> { } } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone)] pub struct ScriptData<'a>(pub Vec>); impl<'a> ScriptData<'a> { diff --git a/flv/src/sound.rs b/flv/src/sound.rs index 74fa347d7..f3b8634d3 100644 --- a/flv/src/sound.rs +++ b/flv/src/sound.rs @@ -2,7 +2,7 @@ use crate::FlvReader; use std::io::Seek; #[repr(u8)] -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] pub enum SoundFormat { LinearPCMPlatformEndian = 0, Adpcm = 1, @@ -43,7 +43,7 @@ impl TryFrom for SoundFormat { } #[repr(u8)] -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] pub enum SoundRate { R5_500 = 0, R11_000 = 1, @@ -66,7 +66,7 @@ impl TryFrom for SoundRate { } #[repr(u8)] -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] pub enum SoundSize { Bits8 = 0, Bits16 = 1, @@ -85,7 +85,7 @@ impl TryFrom for SoundSize { } #[repr(u8)] -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] pub enum SoundType { Mono = 0, Stereo = 1, @@ -103,14 +103,14 @@ impl TryFrom for SoundType { } } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone)] pub enum AudioDataType<'a> { Raw(&'a [u8]), AacSequenceHeader(&'a [u8]), AacRaw(&'a [u8]), } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone)] pub struct AudioData<'a> { pub format: SoundFormat, pub rate: SoundRate, diff --git a/flv/src/tag.rs b/flv/src/tag.rs index 3d313a7cb..cf315b611 100644 --- a/flv/src/tag.rs +++ b/flv/src/tag.rs @@ -6,14 +6,14 @@ use crate::video::VideoData; use std::io::{Seek, SeekFrom}; #[repr(u8)] -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone)] pub enum TagData<'a> { Audio(AudioData<'a>) = 8, Video(VideoData<'a>) = 9, Script(ScriptData<'a>) = 18, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone)] pub struct Tag<'a> { timestamp: i32, stream_id: u32, //24 bits max diff --git a/flv/src/video.rs b/flv/src/video.rs index f2ba6f363..b89aeee95 100644 --- a/flv/src/video.rs +++ b/flv/src/video.rs @@ -55,7 +55,8 @@ impl TryFrom for CodecId { } } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] +#[repr(u8)] pub enum CommandFrame { StartOfClientSideSeek = 0, EndOfClientSideSeek = 1, @@ -73,7 +74,7 @@ impl TryFrom for CommandFrame { } } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone)] pub enum VideoPacket<'a> { Data(&'a [u8]), AvcSequenceHeader(&'a [u8]), @@ -85,7 +86,7 @@ pub enum VideoPacket<'a> { CommandFrame(CommandFrame), } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone)] pub struct VideoData<'a> { pub frame_type: FrameType, pub codec_id: CodecId,