-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4459e5e
commit 82115f9
Showing
36 changed files
with
1,898 additions
and
1,581 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
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 |
---|---|---|
@@ -1,19 +1,29 @@ | ||
[package] | ||
name = "flv" | ||
name = "scuffle-flv" | ||
version = "0.0.1" | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/scufflecloud/scuffle" | ||
authors = ["Scuffle <[email protected]>"] | ||
readme = "README.md" | ||
documentation = "https://docs.rs/scuffle-flv" | ||
description = "A pure Rust FLV demuxer." | ||
keywords = ["flv", "demuxer"] | ||
|
||
[lints.rust] | ||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } | ||
|
||
[dependencies] | ||
byteorder = "1.5" | ||
bytes = "1.5" | ||
num-traits = "0.2" | ||
num-derive = "0.4" | ||
thiserror = "2.0" | ||
|
||
scuffle-av1.workspace = true | ||
h264 = { path = "../h264" } | ||
h265 = { path = "../h265" } | ||
scuffle-aac = { path = "../aac" } | ||
scuffle-bytes-util.workspace = true | ||
scuffle-av1.workspace = true | ||
scuffle-amf0.workspace = true | ||
scuffle-workspace-hack.workspace = true |
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 @@ | ||
../../LICENSE.Apache-2.0 |
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 @@ | ||
../../LICENSE.MIT |
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,17 @@ | ||
# scuffle-flv | ||
|
||
> [!WARNING] | ||
> This crate is under active development and may not be stable. | ||
[![crates.io](https://img.shields.io/crates/v/scuffle-flv.svg)](https://crates.io/crates/scuffle-flv) [![docs.rs](https://img.shields.io/docsrs/scuffle-flv)](https://docs.rs/scuffle-flv) | ||
|
||
--- | ||
|
||
A pure Rust implementation of the FLV format, allowing for demuxing of FLV files or streams. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT](./LICENSE.MIT) or [Apache-2.0](./LICENSE.Apache-2.0) license. | ||
You can choose between one of them if you use this work. | ||
|
||
`SPDX-License-Identifier: MIT OR Apache-2.0` |
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,44 @@ | ||
use bytes::Bytes; | ||
use scuffle_bytes_util::BytesCursorExt; | ||
|
||
use crate::macros::nutype_enum; | ||
|
||
nutype_enum! { | ||
/// FLV AAC Packet Type | ||
/// | ||
/// Defined in the FLV specification. Chapter 1 - AACAUDIODATA | ||
/// | ||
/// The AACPacketType indicates the type of data in the AACAUDIODATA. | ||
pub enum AacPacketType(u8) { | ||
/// Sequence Header | ||
SequenceHeader = 0x0, | ||
/// Raw | ||
Raw = 0x1, | ||
} | ||
} | ||
|
||
/// AAC Packet | ||
/// This is a container for aac data. | ||
/// This enum contains the data for the different types of aac packets. | ||
/// Defined in the FLV specification. Chapter 1 - AACAUDIODATA | ||
#[derive(Debug, Clone, PartialEq)] | ||
pub enum AacPacket { | ||
/// AAC Sequence Header | ||
SequenceHeader(Bytes), | ||
/// AAC Raw | ||
Raw(Bytes), | ||
/// Data we don't know how to parse | ||
Unknown { aac_packet_type: AacPacketType, data: Bytes }, | ||
} | ||
|
||
impl AacPacket { | ||
pub fn demux(aac_packet_type: AacPacketType, reader: &mut std::io::Cursor<Bytes>) -> std::io::Result<Self> { | ||
let data = reader.extract_remaining(); | ||
|
||
match aac_packet_type { | ||
AacPacketType::Raw => Ok(AacPacket::Raw(data)), | ||
AacPacketType::SequenceHeader => Ok(AacPacket::SequenceHeader(data)), | ||
_ => Ok(AacPacket::Unknown { aac_packet_type, data }), | ||
} | ||
} | ||
} |
Oops, something went wrong.