Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for matroska / webm #66

Merged
merged 48 commits into from
Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f401136
mkv: Initial support
darksv Nov 11, 2021
52ec739
mkv: apply some cleanup suggestions
darksv Nov 15, 2021
205d25c
mkv: introduce ElementData enum
darksv Nov 15, 2021
41487d0
mkv: use actual audio parameters
darksv Nov 15, 2021
5293a47
mkv: ignore CRC32 elements for now
darksv Nov 15, 2021
5ec5663
mkv: add some convenience methods on ElementIterator for reading elem…
darksv Nov 16, 2021
08961ad
mkv: add support for lacing in blocks
darksv Nov 17, 2021
f236d7f
mkv: some improvements in read_packet
darksv Nov 17, 2021
f6368a9
mkv: handle vorbis audio tracks
darksv Nov 18, 2021
6c492e4
mkv: remove some unwraps
darksv Nov 18, 2021
b8234f3
mkv: add variants of AAC
darksv Nov 18, 2021
30989f8
mkv: fixed off-by-one error in FixedSize lacing mode
darksv Nov 18, 2021
78b2e49
mkv: use HashMap with lazy_static for list of elements
darksv Nov 19, 2021
e387642
mkv: don't crash when audio track has custom number of channels
darksv Nov 19, 2021
db0515a
mkv: show actual playback position
darksv Nov 19, 2021
51c4b05
mkv: minor refactor in MkvReader
darksv Nov 20, 2021
9f05d14
mkv: extract flac stream info
darksv Nov 20, 2021
4a5648a
mkv: factor out some modules
darksv Nov 20, 2021
b859ec6
mkv: remove asserts from next_packet
darksv Nov 27, 2021
79e8091
mkv: add basic support for seeking
darksv Nov 27, 2021
cd4a1e9
mkv: add support for seeking forward
darksv Dec 5, 2021
14a3ab5
mkv: fix reading of duration and timescale from InfoElement
darksv Dec 5, 2021
02a5bb1
mkv: remove SegmentElement
darksv Dec 7, 2021
45bde71
mkv: read tags
darksv Dec 11, 2021
580f71b
mkv: calculate actual frame duration when possible
darksv Dec 26, 2021
4e4ca5f
mkv: various cleanups and some missing docs
darksv Jan 6, 2022
7e2649f
mkv: fix offsets of blocks
darksv Jan 7, 2022
63df219
mkv: minor code improvements
darksv Jan 9, 2022
7f3e194
mkv: add license info
darksv Jan 9, 2022
439198e
mkv: cleanup some unwraps
darksv Jan 9, 2022
bb32517
mkv: run clippy and fix all the warnings
darksv Jan 9, 2022
0f4dbb9
mkv: do not warn about ignored elements
darksv Jan 9, 2022
8a0e268
mkv: make {writing,muxing}_app optional
darksv Jan 11, 2022
8b37a31
mkv: do not panic for empty vorbis packets
darksv Jan 11, 2022
3d578aa
mkv: validate EMBL tag length
darksv Jan 11, 2022
86c345a
mkv: truncate track number
darksv Jan 11, 2022
68970d0
mkv: do not read EBML header implicitly inside `read_element_data`
darksv Jan 11, 2022
b54aa0d
mkv: seek to next supported EBML tag
darksv Jan 17, 2022
15dcd05
mkv: improve handling of clusters with unknown size
darksv Jan 17, 2022
6b4f6c5
mkv: improve EBML parsing to be more resilient
darksv Jan 22, 2022
34e7bfa
mkv: remove some decode errors from `next_element`
darksv Jan 23, 2022
8e5fce3
mkv: removed a possible panic in `ElementIterator::read_elements`
darksv Jan 23, 2022
87ba1d4
mkv: use SeekHead element when possible so it is no longer required t…
darksv Jan 27, 2022
0b5142d
mkv: return IoError when an end of stream is reached
darksv Jan 27, 2022
ee90e46
mkv: use
darksv Jan 28, 2022
d2040d2
mkv: update Cargo.toml
darksv Jan 29, 2022
2935f05
mkv: fix last clippy lints
darksv Jan 29, 2022
1ffb601
mkv: run rustfmt
darksv Jan 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Thom Chiovoloni <chiovolonit@gmail.com>
# Please keep this section sorted in ascending order.

BlackHoleFox [https://github.com/blackholefox]
darksv [https://github.com/darksv]
djugei [https://github.com/djugei]
FelixMcFelix [https://github.com/FelixMcFelix]
Herohtar [https://github.com/herohtar]
Expand Down
10 changes: 6 additions & 4 deletions symphonia-format-mkv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[package]
name = "symphonia-format-mkv"
version = "0.0.1"
version = "0.4.0"
description = "Pure Rust MKV/WebM demuxer (a part of project Symphonia)."
homepage = "https://github.com/pdeljanov/Symphonia"
repository = "https://github.com/pdeljanov/Symphonia"
authors = ["Philip Deljanov <philip.deljanov@gmail.com>"]
authors = ["Dariusz Niedoba <dariusz.niedoba@gmail.com>"]
license = "MPL-2.0"
readme = "README.md"
categories = ["multimedia", "multimedia::audio", "multimedia::encoding"]
keywords = ["audio", "media", "demuxer", "mp4", "iso"]
keywords = ["audio", "media", "demuxer", "mkv", "matroska", "webm"]
edition = "2018"

[dependencies]
log = "0.4"
lazy_static = "1.4.0"
symphonia-core = { version = "0.4", path = "../symphonia-core" }
symphonia-metadata = { version = "0.4", path = "../symphonia-metadata" }
symphonia-metadata = { version = "0.4", path = "../symphonia-metadata" }
symphonia-utils-xiph = { version = "0.4", path = "../symphonia-utils-xiph" }
4 changes: 1 addition & 3 deletions symphonia-format-mkv/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Symphonia MKV/WebM Demuxer

This is a placeholder crate for Project Symphonia's MKV/WebM Demuxer.

Please consider contributing!
MKV/WebM demuxer for Project Symphonia.

**Note:** This crate is part of Symphonia. Please use the [`symphonia`](https://crates.io/crates/symphonia) crate instead of this one directly.

Expand Down
48 changes: 48 additions & 0 deletions symphonia-format-mkv/src/codecs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Symphonia
// Copyright (c) 2019-2022 The Project Symphonia Developers.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use symphonia_core::codecs;
use symphonia_core::codecs::CodecType;

use crate::segment::TrackElement;

pub(crate) fn codec_id_to_type(track: &TrackElement) -> Option<CodecType> {
let bit_depth = track.audio.as_ref().and_then(|a| a.bit_depth);

match track.codec_id.as_str() {
"A_MPEG/L1" => Some(codecs::CODEC_TYPE_MP1),
"A_MPEG/L2" => Some(codecs::CODEC_TYPE_MP2),
"A_MPEG/L3" => Some(codecs::CODEC_TYPE_MP3),
"A_FLAC" => Some(codecs::CODEC_TYPE_FLAC),
"A_OPUS" => Some(codecs::CODEC_TYPE_OPUS),
"A_VORBIS" => Some(codecs::CODEC_TYPE_VORBIS),
"A_AAC/MPEG2/MAIN" | "A_AAC/MPEG2/LC" | "A_AAC/MPEG2/LC/SBR" | "A_AAC/MPEG2/SSR"
| "A_AAC/MPEG4/MAIN" | "A_AAC/MPEG4/LC" | "A_AAC/MPEG4/LC/SBR" | "A_AAC/MPEG4/SSR"
| "A_AAC/MPEG4/LTP" | "A_AAC" => Some(codecs::CODEC_TYPE_AAC),
"A_PCM/INT/BIG" => match bit_depth? {
16 => Some(codecs::CODEC_TYPE_PCM_S16BE),
24 => Some(codecs::CODEC_TYPE_PCM_S24BE),
32 => Some(codecs::CODEC_TYPE_PCM_S32BE),
_ => None,
},
"A_PCM/INT/LIT" => match bit_depth? {
16 => Some(codecs::CODEC_TYPE_PCM_S16LE),
24 => Some(codecs::CODEC_TYPE_PCM_S24LE),
32 => Some(codecs::CODEC_TYPE_PCM_S32LE),
_ => None,
},
"A_PCM/FLOAT/IEEE" => match bit_depth? {
32 => Some(codecs::CODEC_TYPE_PCM_F32LE),
64 => Some(codecs::CODEC_TYPE_PCM_F64LE),
_ => None,
},
_ => {
log::warn!("unknown codec: {}", &track.codec_id);
None
}
}
}
Loading