flv_codec

Crates.ioflv_codec
lib.rsflv_codec
version0.1.0
sourcesrc
created_at2018-07-06 10:46:15.110525
updated_at2018-07-10 19:00:18.496049
descriptionDecoders and encoders for FLV file format
homepagehttps://github.com/sile/flv_codec
repositoryhttps://github.com/sile/flv_codec
max_upload_size
id73101
size158,906
Takeru Ohta (sile)

documentation

README

flv_codec

flv_codec Documentation Build Status Code Coverage License: MIT

Decoders and encoders for FLV file format.

Documentation

Examples

use bytecodec::io::IoDecodeExt;
use flv_codec::{FileDecoder, Header, Tag};

// Reads FLV file content
let mut flv = &include_bytes!("../black_silent.flv")[..];
let mut decoder = FileDecoder::new();

// Decodes the first FLV tag
let tag = decoder.decode_exact(&mut flv).unwrap();
let header = decoder.header().cloned().unwrap();
assert_eq!(header, Header { has_audio: true, has_video: true });
assert_eq!(tag.timestamp().value(), 0);
assert_eq!(tag.stream_id().value(), 0);
match tag {
    Tag::Audio(_) => println!("audio tag"),
    Tag::Video(_) => println!("video tag"),
    Tag::ScriptData(_) => println!("script data tag"),
}

// Decodes the second FLV tag
let tag = decoder.decode_exact(&mut flv).unwrap();

See examples/ directory for more examples.

References

Commit count: 24

cargo fmt