flv: Add new crate for FLV (de)muxing
This commit is contained in:
parent
8f0a43f9d9
commit
5b93a9e316
|
@ -1645,6 +1645,13 @@ dependencies = [
|
|||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flv-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 2.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
|
|
|
@ -5,6 +5,7 @@ members = [
|
|||
"core/build_playerglobal",
|
||||
"desktop",
|
||||
"swf",
|
||||
"flv",
|
||||
"web",
|
||||
"web/packages/extension/safari",
|
||||
"wstr",
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "flv-rs"
|
||||
version = "0.1.0"
|
||||
authors = ["David Wendt <dcrkid@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "2.0.0"
|
|
@ -0,0 +1,14 @@
|
|||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
pub struct TypeFlags: u8 {
|
||||
const HAS_AUDIO = 0b1000_0000;
|
||||
const HAS_VIDEO = 0b0010_0000;
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Header {
|
||||
version: u8,
|
||||
type_flags: TypeFlags,
|
||||
data_offset: u32,
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
mod header;
|
||||
mod sound;
|
||||
mod tag;
|
|
@ -0,0 +1,36 @@
|
|||
#[repr(u8)]
|
||||
pub enum SoundFormat {
|
||||
LinearPCMPlatformEndian = 0,
|
||||
Adpcm = 1,
|
||||
MP3 = 2,
|
||||
LinearPCMLittleEndian = 3,
|
||||
Nellymoser16kHz = 4,
|
||||
Nellymoser8kHz = 5,
|
||||
Nellymoser = 6,
|
||||
G711ALawPCM = 7,
|
||||
G711MuLawPCM = 8,
|
||||
Aac = 10,
|
||||
Speex = 11,
|
||||
MP38kHz = 14,
|
||||
DeviceSpecific = 15,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum SoundRate {
|
||||
R5_500 = 0,
|
||||
R11_000 = 1,
|
||||
R22_000 = 2,
|
||||
R44_000 = 3,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum SoundSize {
|
||||
Bits8 = 0,
|
||||
Bits16 = 1,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum SoundType {
|
||||
Mono = 0,
|
||||
Stereo = 1,
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
use crate::sound::{SoundFormat, SoundRate, SoundSize, SoundType};
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum TagData<'a> {
|
||||
Audio {
|
||||
format: SoundFormat,
|
||||
rate: SoundRate,
|
||||
size: SoundSize,
|
||||
sound_type: SoundType,
|
||||
data: &'a [u8],
|
||||
} = 8,
|
||||
Video = 9,
|
||||
Script = 18,
|
||||
}
|
||||
|
||||
pub struct Tag<'a> {
|
||||
timestamp: i32,
|
||||
stream_id: u32, //24 bits max
|
||||
data: TagData<'a>,
|
||||
}
|
Loading…
Reference in New Issue