pub enum Tag<Data = Vec<u8>> {
Audio(AudioTag<Data>),
Video(VideoTag<Data>),
ScriptData(ScriptDataTag<Data>),
}Expand description
FLV tag.
Variants§
Audio(AudioTag<Data>)
Audio tag.
Video(VideoTag<Data>)
Video tag.
ScriptData(ScriptDataTag<Data>)
Script data tag.
Implementations§
Source§impl<Data> Tag<Data>
impl<Data> Tag<Data>
Sourcepub fn timestamp(&self) -> Timestamp
pub fn timestamp(&self) -> Timestamp
Returns the timestamp of the tag.
Examples found in repository?
examples/parse.rs (line 34)
11fn main() -> Result<(), MainError> {
12 let stdin = std::io::stdin();
13 let mut input = stdin.lock();
14 let mut buf = ReadBuf::new(vec![0; 1024]);
15 let mut decoder = FileDecoder::new();
16 let mut is_header_shown = false;
17
18 while !buf.stream_state().is_eos() {
19 track!(buf.fill(&mut input))?;
20 track!(decoder.decode_from_read_buf(&mut buf))?;
21 if let Some(h) = decoder.header() {
22 if !is_header_shown {
23 println!("[header]");
24 println!("has_audio = {}", h.has_audio);
25 println!("has_video = {}", h.has_video);
26 println!("");
27 is_header_shown = true;
28 }
29 }
30 if decoder.is_idle() {
31 let tag = track!(decoder.finish_decoding())?;
32 println!("[[tags]]");
33 println!("type = {:?}", tag_type(&tag));
34 println!("timestamp = {}", tag.timestamp().value());
35 println!("stream_id = {}", tag.stream_id().value());
36 println!("");
37 }
38 }
39
40 Ok(())
41}Sourcepub fn stream_id(&self) -> StreamId
pub fn stream_id(&self) -> StreamId
Returns the stream identifier of the tag.
Examples found in repository?
examples/parse.rs (line 35)
11fn main() -> Result<(), MainError> {
12 let stdin = std::io::stdin();
13 let mut input = stdin.lock();
14 let mut buf = ReadBuf::new(vec![0; 1024]);
15 let mut decoder = FileDecoder::new();
16 let mut is_header_shown = false;
17
18 while !buf.stream_state().is_eos() {
19 track!(buf.fill(&mut input))?;
20 track!(decoder.decode_from_read_buf(&mut buf))?;
21 if let Some(h) = decoder.header() {
22 if !is_header_shown {
23 println!("[header]");
24 println!("has_audio = {}", h.has_audio);
25 println!("has_video = {}", h.has_video);
26 println!("");
27 is_header_shown = true;
28 }
29 }
30 if decoder.is_idle() {
31 let tag = track!(decoder.finish_decoding())?;
32 println!("[[tags]]");
33 println!("type = {:?}", tag_type(&tag));
34 println!("timestamp = {}", tag.timestamp().value());
35 println!("stream_id = {}", tag.stream_id().value());
36 println!("");
37 }
38 }
39
40 Ok(())
41}Trait Implementations§
Source§impl<Data> From<ScriptDataTag<Data>> for Tag<Data>
impl<Data> From<ScriptDataTag<Data>> for Tag<Data>
Source§fn from(f: ScriptDataTag<Data>) -> Self
fn from(f: ScriptDataTag<Data>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<Data> Freeze for Tag<Data>where
Data: Freeze,
impl<Data> RefUnwindSafe for Tag<Data>where
Data: RefUnwindSafe,
impl<Data> Send for Tag<Data>where
Data: Send,
impl<Data> Sync for Tag<Data>where
Data: Sync,
impl<Data> Unpin for Tag<Data>where
Data: Unpin,
impl<Data> UnwindSafe for Tag<Data>where
Data: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more