mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-04 10:43:53 +00:00
rtp: Update to bitstream-io 4.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2219>
This commit is contained in:
parent
9d1de72aa8
commit
cb1a04465e
4 changed files with 38 additions and 15 deletions
23
Cargo.lock
generated
23
Cargo.lock
generated
|
@ -964,9 +964,18 @@ checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2"
|
|||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "3.2.0"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "680575de65ce8b916b82a447458b94a48776707d9c2681a9d8da351c06886a1f"
|
||||
checksum = "0a5b5a2b75d152e75add7773b5806f86fdea1731126d05dc8491b89dbede8cf5"
|
||||
dependencies = [
|
||||
"core2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dc7691a79ba3cf60484e3fb6c53003b2a609921b6578aec7726a655939266d6"
|
||||
dependencies = [
|
||||
"core2",
|
||||
]
|
||||
|
@ -2647,7 +2656,7 @@ version = "0.14.0-alpha.1"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"atomic_refcell",
|
||||
"bitstream-io 3.2.0",
|
||||
"bitstream-io 3.3.0",
|
||||
"byteorder",
|
||||
"cairo-rs",
|
||||
"cdp-types",
|
||||
|
@ -2758,7 +2767,7 @@ name = "gst-plugin-fmp4"
|
|||
version = "0.14.0-alpha.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitstream-io 3.2.0",
|
||||
"bitstream-io 3.3.0",
|
||||
"chrono",
|
||||
"dash-mpd",
|
||||
"gst-plugin-version-helper",
|
||||
|
@ -2938,7 +2947,7 @@ name = "gst-plugin-mp4"
|
|||
version = "0.14.0-alpha.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitstream-io 3.2.0",
|
||||
"bitstream-io 3.3.0",
|
||||
"gst-plugin-version-helper",
|
||||
"gstreamer",
|
||||
"gstreamer-audio",
|
||||
|
@ -2956,7 +2965,7 @@ name = "gst-plugin-mpegtslive"
|
|||
version = "0.14.0-alpha.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitstream-io 3.2.0",
|
||||
"bitstream-io 3.3.0",
|
||||
"gst-plugin-version-helper",
|
||||
"gstreamer",
|
||||
"smallvec",
|
||||
|
@ -3127,7 +3136,7 @@ version = "0.14.0-alpha.1"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"atomic_refcell",
|
||||
"bitstream-io 3.2.0",
|
||||
"bitstream-io 4.0.0",
|
||||
"byte-slice-cast",
|
||||
"chrono",
|
||||
"futures",
|
||||
|
|
|
@ -11,7 +11,7 @@ rust-version.workspace = true
|
|||
[dependencies]
|
||||
anyhow = "1"
|
||||
atomic_refcell = "0.1"
|
||||
bitstream-io = "3"
|
||||
bitstream-io = "4"
|
||||
byte-slice-cast = "1.2"
|
||||
chrono = { version = "0.4", default-features = false }
|
||||
gst = { workspace = true, features = ["v1_20"] }
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* Since: plugins-rs-0.13.0
|
||||
*/
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use bitstream_io::{BigEndian, BitCounter, BitRead, BitReader, BitWrite, BitWriter};
|
||||
use bitstream_io::{BigEndian, BitRead, BitReader, BitWrite, BitWriter, BitsWritten};
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use gst::{glib, prelude::*, subclass::prelude::*};
|
||||
|
@ -736,7 +736,7 @@ impl RtpMpeg4GenericPay {
|
|||
}
|
||||
|
||||
// Unfortunately BitWriter doesn't return the size written.
|
||||
let mut c = BitCounter::<u32, BigEndian>::new();
|
||||
let mut c = BitsWritten::<u32>::new();
|
||||
c.build_with(&header, &ctx).unwrap();
|
||||
let header_bit_len = c.written() as u16;
|
||||
|
||||
|
@ -880,7 +880,7 @@ impl RtpMpeg4GenericPay {
|
|||
})?;
|
||||
|
||||
// Unfortunately BitWriter doesn't return the size written.
|
||||
let mut c = BitCounter::<u32, BigEndian>::new();
|
||||
let mut c = BitsWritten::<u32>::new();
|
||||
c.build_with(&header, &ctx).unwrap();
|
||||
let header_bit_len = c.written() as u16;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use bitstream_io::{BigEndian, BitRead, Endianness, UnsignedInteger as _};
|
||||
use bitstream_io::{BitRead, Endianness, UnsignedInteger as _};
|
||||
use std::{io, mem};
|
||||
|
||||
/// Implementation of the bool decoder from RFC 6386:
|
||||
|
@ -139,11 +139,21 @@ impl<R: io::Read> BitRead for BoolDecoder<R> {
|
|||
|
||||
fn read_signed_counted<const MAX: u32, S>(
|
||||
&mut self,
|
||||
bits: bitstream_io::BitCount<MAX>,
|
||||
bits: impl TryInto<bitstream_io::SignedBitCount<MAX>>,
|
||||
) -> io::Result<S>
|
||||
where
|
||||
S: bitstream_io::SignedInteger,
|
||||
{
|
||||
let bits = bits
|
||||
.try_into()
|
||||
.map_err(|_| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"signed writes need at least 1 bit for sign",
|
||||
)
|
||||
})?
|
||||
.count();
|
||||
|
||||
let sign = self.next_bit()?;
|
||||
let v = self.read_unsigned_counted::<MAX, S::Unsigned>(
|
||||
bits.checked_sub::<MAX>(1).ok_or(io::Error::new(
|
||||
|
@ -162,7 +172,9 @@ impl<R: io::Read> BitRead for BoolDecoder<R> {
|
|||
where
|
||||
V: bitstream_io::Primitive,
|
||||
{
|
||||
BigEndian::read_primitive(self)
|
||||
let mut buffer = V::buffer();
|
||||
self.read_bytes(buffer.as_mut())?;
|
||||
Ok(V::from_be_bytes(buffer))
|
||||
}
|
||||
|
||||
fn read_as_to<F, V>(&mut self) -> io::Result<V>
|
||||
|
@ -170,7 +182,9 @@ impl<R: io::Read> BitRead for BoolDecoder<R> {
|
|||
F: Endianness,
|
||||
V: bitstream_io::Primitive,
|
||||
{
|
||||
F::read_primitive(self)
|
||||
let mut buffer = V::buffer();
|
||||
self.read_bytes(buffer.as_mut())?;
|
||||
Ok(F::bytes_to_primitive(buffer))
|
||||
}
|
||||
|
||||
fn byte_aligned(&self) -> bool {
|
||||
|
|
Loading…
Reference in a new issue