forked from mirrors/gecko-dev
Bug 1739032 - Update mp4parse-rust to a257137. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D130284
This commit is contained in:
parent
cdfd8d15eb
commit
bd29528356
19 changed files with 158 additions and 99 deletions
|
|
@ -15,7 +15,7 @@ tag = "v0.5.3"
|
|||
[source."https://github.com/mozilla/mp4parse-rust"]
|
||||
git = "https://github.com/mozilla/mp4parse-rust"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "72eb355ddeada541d7e57dbe5fb60eb5124dea0d"
|
||||
rev = "a25713781eac774c531af43ba833ef86cb920889"
|
||||
|
||||
[source."https://github.com/mozilla/l10nregistry-rs"]
|
||||
git = "https://github.com/mozilla/l10nregistry-rs"
|
||||
|
|
|
|||
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -3185,8 +3185,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mp4parse"
|
||||
version = "0.11.5"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=72eb355ddeada541d7e57dbe5fb60eb5124dea0d#72eb355ddeada541d7e57dbe5fb60eb5124dea0d"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=a25713781eac774c531af43ba833ef86cb920889#a25713781eac774c531af43ba833ef86cb920889"
|
||||
dependencies = [
|
||||
"bitreader",
|
||||
"byteorder",
|
||||
|
|
@ -3203,8 +3203,8 @@ version = "0.1.0"
|
|||
|
||||
[[package]]
|
||||
name = "mp4parse_capi"
|
||||
version = "0.11.5"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=72eb355ddeada541d7e57dbe5fb60eb5124dea0d#72eb355ddeada541d7e57dbe5fb60eb5124dea0d"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=a25713781eac774c531af43ba833ef86cb920889#a25713781eac774c531af43ba833ef86cb920889"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"fallible_collections",
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ struct AVIFDecodedData : layers::PlanarYCbCrData {
|
|||
CICP::MatrixCoefficients mMatrixCoefficients = CICP::MC_UNSPECIFIED;
|
||||
|
||||
void SetCicpValues(
|
||||
const NclxColourInformation* aNclx,
|
||||
const Mp4parseNclxColourInformation* aNclx,
|
||||
const CICP::ColourPrimaries aAv1ColourPrimaries,
|
||||
const CICP::TransferCharacteristics aAv1TransferCharacteristics,
|
||||
const CICP::MatrixCoefficients aAv1MatrixCoefficients);
|
||||
|
|
@ -346,8 +346,8 @@ struct AVIFDecodedData : layers::PlanarYCbCrData {
|
|||
// that work unnecessarily because in addition to wasted effort, it would make
|
||||
// the logging more confusing.
|
||||
template <typename F>
|
||||
static gfx::YUVColorSpace GetAVIFColorSpace(const NclxColourInformation* aNclx,
|
||||
F&& aBitstreamColorSpaceFunc) {
|
||||
static gfx::YUVColorSpace GetAVIFColorSpace(
|
||||
const Mp4parseNclxColourInformation* aNclx, F&& aBitstreamColorSpaceFunc) {
|
||||
return ToMaybe(aNclx)
|
||||
.map([=](const auto& nclx) {
|
||||
return gfxUtils::CicpToColorSpace(
|
||||
|
|
@ -359,8 +359,9 @@ static gfx::YUVColorSpace GetAVIFColorSpace(const NclxColourInformation* aNclx,
|
|||
.valueOr(gfx::YUVColorSpace::BT601);
|
||||
}
|
||||
|
||||
static gfx::ColorRange GetAVIFColorRange(const NclxColourInformation* aNclx,
|
||||
const gfx::ColorRange av1ColorRange) {
|
||||
static gfx::ColorRange GetAVIFColorRange(
|
||||
const Mp4parseNclxColourInformation* aNclx,
|
||||
const gfx::ColorRange av1ColorRange) {
|
||||
return ToMaybe(aNclx)
|
||||
.map([=](const auto& nclx) {
|
||||
return aNclx->full_range_flag ? gfx::ColorRange::FULL
|
||||
|
|
@ -370,7 +371,7 @@ static gfx::ColorRange GetAVIFColorRange(const NclxColourInformation* aNclx,
|
|||
}
|
||||
|
||||
void AVIFDecodedData::SetCicpValues(
|
||||
const NclxColourInformation* aNclx,
|
||||
const Mp4parseNclxColourInformation* aNclx,
|
||||
const CICP::ColourPrimaries aAv1ColourPrimaries,
|
||||
const CICP::TransferCharacteristics aAv1TransferCharacteristics,
|
||||
const CICP::MatrixCoefficients aAv1MatrixCoefficients) {
|
||||
|
|
@ -645,7 +646,7 @@ class Dav1dDecoder final : AVIFDecoderInterface {
|
|||
}
|
||||
|
||||
static AVIFDecodedData Dav1dPictureToDecodedData(
|
||||
const NclxColourInformation* aNclx, Dav1dPicture* aPicture,
|
||||
const Mp4parseNclxColourInformation* aNclx, Dav1dPicture* aPicture,
|
||||
Dav1dPicture* aAlphaPlane, bool aPremultipliedAlpha);
|
||||
|
||||
Dav1dContext* mContext = nullptr;
|
||||
|
|
@ -926,7 +927,7 @@ class AOMDecoder final : AVIFDecoderInterface {
|
|||
};
|
||||
|
||||
static AVIFDecodedData AOMImageToToDecodedData(
|
||||
const NclxColourInformation* aNclx, aom_image_t* aImage,
|
||||
const Mp4parseNclxColourInformation* aNclx, aom_image_t* aImage,
|
||||
aom_image_t* aAlphaPlane, bool aPremultipliedAlpha);
|
||||
|
||||
Maybe<aom_codec_ctx_t> mContext;
|
||||
|
|
@ -936,7 +937,7 @@ class AOMDecoder final : AVIFDecoderInterface {
|
|||
|
||||
/* static */
|
||||
AVIFDecodedData Dav1dDecoder::Dav1dPictureToDecodedData(
|
||||
const NclxColourInformation* aNclx, Dav1dPicture* aPicture,
|
||||
const Mp4parseNclxColourInformation* aNclx, Dav1dPicture* aPicture,
|
||||
Dav1dPicture* aAlphaPlane, bool aPremultipliedAlpha) {
|
||||
MOZ_ASSERT(aPicture);
|
||||
|
||||
|
|
@ -1026,7 +1027,7 @@ AVIFDecodedData Dav1dDecoder::Dav1dPictureToDecodedData(
|
|||
|
||||
/* static */
|
||||
AVIFDecodedData AOMDecoder::AOMImageToToDecodedData(
|
||||
const NclxColourInformation* aNclx, aom_image_t* aImage,
|
||||
const Mp4parseNclxColourInformation* aNclx, aom_image_t* aImage,
|
||||
aom_image_t* aAlphaPlane, bool aPremultipliedAlpha) {
|
||||
MOZ_ASSERT(aImage);
|
||||
MOZ_ASSERT(aImage->stride[AOM_PLANE_Y] == aImage->stride[AOM_PLANE_ALPHA]);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
third_party/rust/mp4parse/Cargo.toml
vendored
2
third_party/rust/mp4parse/Cargo.toml
vendored
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mp4parse"
|
||||
version = "0.11.5"
|
||||
version = "0.12.0"
|
||||
authors = [
|
||||
"Ralph Giles <giles@mozilla.com>",
|
||||
"Matthew Gregan <kinetik@flim.org>",
|
||||
|
|
|
|||
127
third_party/rust/mp4parse/src/lib.rs
vendored
127
third_party/rust/mp4parse/src/lib.rs
vendored
|
|
@ -51,8 +51,6 @@ const MIF1_BRAND: FourCC = FourCC { value: *b"mif1" };
|
|||
/// A trait to indicate a type can be infallibly converted to `u64`.
|
||||
/// This should only be implemented for infallible conversions, so only unsigned types are valid.
|
||||
trait ToU64 {
|
||||
// Remove when https://github.com/rust-lang/rust-clippy/issues/6727 is resolved
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn to_u64(self) -> u64;
|
||||
}
|
||||
|
||||
|
|
@ -227,6 +225,12 @@ impl From<fallible_collections::TryReserveError> for Status {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Status {
|
||||
fn from(_: std::io::Error) -> Self {
|
||||
Status::Io
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes parser failures.
|
||||
///
|
||||
/// This enum wraps the standard `io::Error` type, unified with
|
||||
|
|
@ -320,7 +324,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
|||
/// four-byte box type which identifies the type of the box. Together these
|
||||
/// are enough to interpret the contents of that section of the file.
|
||||
///
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 4.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 4.2
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
struct BoxHeader {
|
||||
/// Box type.
|
||||
|
|
@ -864,7 +868,7 @@ pub struct MetadataBox {
|
|||
pub xml: Option<XmlBox>,
|
||||
}
|
||||
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.2.1
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.2.1
|
||||
#[cfg(feature = "meta-xml")]
|
||||
#[derive(Debug)]
|
||||
pub enum XmlBox {
|
||||
|
|
@ -902,7 +906,7 @@ enum IsobmffItem {
|
|||
|
||||
#[derive(Debug)]
|
||||
struct AvifItem {
|
||||
/// The `item_ID` from ISOBMFF (ISO 14496-12:2015)
|
||||
/// The `item_ID` from ISOBMFF (ISO 14496-12:2020) § 8.11.3
|
||||
///
|
||||
/// See [`read_iloc`]
|
||||
id: ItemId,
|
||||
|
|
@ -933,7 +937,7 @@ pub struct AvifContext {
|
|||
strictness: ParseStrictness,
|
||||
/// Referred to by the `Location` variants of the `AvifItem`s in this struct
|
||||
item_storage: TryVec<MediaDataBox>,
|
||||
/// The item indicated by the `pitm` box, See ISOBMFF (ISO 14496-12:2015) § 8.11.4
|
||||
/// The item indicated by the `pitm` box, See ISOBMFF (ISO 14496-12:2020) § 8.11.4
|
||||
primary_item: AvifItem,
|
||||
/// Associated alpha channel for the primary item, if any
|
||||
alpha_item: Option<AvifItem>,
|
||||
|
|
@ -1080,7 +1084,7 @@ struct AvifMeta {
|
|||
}
|
||||
|
||||
/// A Media Data Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.1.1
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.1.1
|
||||
struct MediaDataBox {
|
||||
/// Offset of `data` from the beginning of the "file". See ConstructionMethod::File.
|
||||
/// Note: the file may not be an actual file, read_avif supports any `&mut impl Read`
|
||||
|
|
@ -1281,7 +1285,7 @@ impl ItemId {
|
|||
}
|
||||
|
||||
/// Used for 'infe' boxes within 'iinf' boxes
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.6
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.6
|
||||
/// Only versions {2, 3} are supported
|
||||
#[derive(Debug)]
|
||||
struct ItemInfoEntry {
|
||||
|
|
@ -1289,7 +1293,7 @@ struct ItemInfoEntry {
|
|||
item_type: u32,
|
||||
}
|
||||
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.12
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.12
|
||||
#[derive(Debug)]
|
||||
struct SingleItemTypeReferenceBox {
|
||||
item_type: FourCC,
|
||||
|
|
@ -1298,7 +1302,7 @@ struct SingleItemTypeReferenceBox {
|
|||
}
|
||||
|
||||
/// Potential sizes (in bytes) of variable-sized fields of the 'iloc' box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.3
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
enum IlocFieldSize {
|
||||
Zero,
|
||||
|
|
@ -1350,7 +1354,7 @@ impl TryFrom<u8> for IlocVersion {
|
|||
}
|
||||
|
||||
/// Used for 'iloc' boxes
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.3
|
||||
/// `base_offset` is omitted since it is integrated into the ranges in `extents`
|
||||
/// `data_reference_index` is omitted, since only 0 (i.e., this file) is supported
|
||||
#[derive(Debug)]
|
||||
|
|
@ -1360,7 +1364,7 @@ struct ItemLocationBoxItem {
|
|||
extents: TryVec<Extent>,
|
||||
}
|
||||
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.3
|
||||
///
|
||||
/// Note: per MIAF (ISO 23000-22:2019) § 7.2.1.7:<br />
|
||||
/// > MIAF image items are constrained as follows:<br />
|
||||
|
|
@ -1507,7 +1511,7 @@ impl Track {
|
|||
}
|
||||
}
|
||||
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 4.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 4.2
|
||||
struct BMFFBox<'a, T: 'a> {
|
||||
head: BoxHeader,
|
||||
content: Take<&'a mut T>,
|
||||
|
|
@ -1583,7 +1587,7 @@ impl<'a, T> Drop for BMFFBox<'a, T> {
|
|||
/// parsers for the internal content, or to get the length to
|
||||
/// skip unknown or uninteresting boxes.
|
||||
///
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 4.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 4.2
|
||||
fn read_box_header<T: ReadBytesExt>(src: &mut T) -> Result<BoxHeader> {
|
||||
let size32 = be_u32(src)?;
|
||||
let name = BoxType::from(be_u32(src)?);
|
||||
|
|
@ -1694,7 +1698,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
|
||||
let mut iter = BoxIter::new(&mut f);
|
||||
|
||||
// 'ftyp' box must occur first; see ISOBMFF (ISO 14496-12:2015) § 4.3.1
|
||||
// 'ftyp' box must occur first; see ISOBMFF (ISO 14496-12:2020) § 4.3.1
|
||||
if let Some(mut b) = iter.next_box()? {
|
||||
if b.head.name == BoxType::FileTypeBox {
|
||||
let ftyp = read_ftyp(&mut b)?;
|
||||
|
|
@ -1723,7 +1727,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
BoxType::MetadataBox => {
|
||||
if meta.is_some() {
|
||||
return Err(Error::InvalidData(
|
||||
"There should be zero or one meta boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.1.1",
|
||||
"There should be zero or one meta boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.1.1",
|
||||
));
|
||||
}
|
||||
meta = Some(read_avif_meta(&mut b, strictness)?);
|
||||
|
|
@ -1896,7 +1900,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
/// Parse a metadata box in the context of an AVIF
|
||||
/// Currently requires the primary item to be an av01 item type and generates
|
||||
/// an error otherwise.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.1
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.1
|
||||
fn read_avif_meta<T: Read + Offset>(
|
||||
src: &mut BMFFBox<T>,
|
||||
strictness: ParseStrictness,
|
||||
|
|
@ -1930,7 +1934,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
BoxType::HandlerBox => {
|
||||
if read_handler_box {
|
||||
return Err(Error::InvalidData(
|
||||
"There shall be exactly one hdlr box per ISOBMFF (ISO 14496-12:2015) § 8.4.3.1",
|
||||
"There shall be exactly one hdlr box per ISOBMFF (ISO 14496-12:2020) § 8.4.3.1",
|
||||
));
|
||||
}
|
||||
let HandlerBox { handler_type } = read_hdlr(&mut b, strictness)?;
|
||||
|
|
@ -1946,7 +1950,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
BoxType::ItemInfoBox => {
|
||||
if item_infos.is_some() {
|
||||
return Err(Error::InvalidData(
|
||||
"There shall be zero or one iinf boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.6.1",
|
||||
"There shall be zero or one iinf boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.6.1",
|
||||
));
|
||||
}
|
||||
item_infos = Some(read_iinf(&mut b, strictness)?);
|
||||
|
|
@ -1954,7 +1958,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
BoxType::ItemLocationBox => {
|
||||
if iloc_items.is_some() {
|
||||
return Err(Error::InvalidData(
|
||||
"There shall be zero or one iloc boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.3.1",
|
||||
"There shall be zero or one iloc boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.3.1",
|
||||
));
|
||||
}
|
||||
iloc_items = Some(read_iloc(&mut b)?);
|
||||
|
|
@ -1962,14 +1966,14 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
BoxType::PrimaryItemBox => {
|
||||
if primary_item_id.is_some() {
|
||||
return Err(Error::InvalidData(
|
||||
"There shall be zero or one pitm boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.4.1",
|
||||
"There shall be zero or one pitm boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.4.1",
|
||||
));
|
||||
}
|
||||
primary_item_id = Some(read_pitm(&mut b)?);
|
||||
}
|
||||
BoxType::ItemReferenceBox => {
|
||||
if item_references.is_some() {
|
||||
return Err(Error::InvalidData("There shall be zero or one iref boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.12.1"));
|
||||
return Err(Error::InvalidData("There shall be zero or one iref boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.12.1"));
|
||||
}
|
||||
item_references = Some(read_iref(&mut b)?);
|
||||
}
|
||||
|
|
@ -2017,7 +2021,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
}
|
||||
|
||||
/// Parse a Primary Item Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.4
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.4
|
||||
fn read_pitm<T: Read>(src: &mut BMFFBox<T>) -> Result<ItemId> {
|
||||
let version = read_fullbox_version_no_flags(src)?;
|
||||
|
||||
|
|
@ -2031,7 +2035,7 @@ fn read_pitm<T: Read>(src: &mut BMFFBox<T>) -> Result<ItemId> {
|
|||
}
|
||||
|
||||
/// Parse an Item Information Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.6
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.6
|
||||
fn read_iinf<T: Read>(
|
||||
src: &mut BMFFBox<T>,
|
||||
strictness: ParseStrictness,
|
||||
|
|
@ -2054,7 +2058,7 @@ fn read_iinf<T: Read>(
|
|||
while let Some(mut b) = iter.next_box()? {
|
||||
if b.head.name != BoxType::ItemInfoEntry {
|
||||
return Err(Error::InvalidData(
|
||||
"iinf box shall contain only infe boxes per ISOBMFF (ISO 14496-12:2015) § 8.11.6.2",
|
||||
"iinf box shall contain only infe boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.6.2",
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -2080,7 +2084,7 @@ impl std::fmt::Display for U32BE {
|
|||
}
|
||||
|
||||
/// Parse an Item Info Entry
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.6.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.6.2
|
||||
fn read_infe<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Result<ItemInfoEntry> {
|
||||
let (version, flags) = read_fullbox_extra(src)?;
|
||||
|
||||
|
|
@ -2091,7 +2095,7 @@ fn read_infe<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Resu
|
|||
fail_if(
|
||||
strictness == ParseStrictness::Strict,
|
||||
"'infe' flags field shall be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2015) § 8.11.6.2",
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.11.6.2",
|
||||
)?;
|
||||
}
|
||||
|
||||
|
|
@ -2118,7 +2122,7 @@ fn read_infe<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Resu
|
|||
}
|
||||
|
||||
/// Parse an Item Reference Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.12
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.12
|
||||
fn read_iref<T: Read>(src: &mut BMFFBox<T>) -> Result<TryVec<SingleItemTypeReferenceBox>> {
|
||||
let mut item_references = TryVec::new();
|
||||
let version = read_fullbox_version_no_flags(src)?;
|
||||
|
|
@ -3041,7 +3045,7 @@ fn read_auxc<T: Read>(src: &mut BMFFBox<T>) -> Result<AuxiliaryTypeProperty> {
|
|||
}
|
||||
|
||||
/// Parse an item location box inside a meta box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.3
|
||||
fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<ItemId, ItemLocationBoxItem>> {
|
||||
let version: IlocVersion = read_fullbox_version_no_flags(src)?.try_into()?;
|
||||
|
||||
|
|
@ -3086,7 +3090,7 @@ fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<ItemId, ItemLoc
|
|||
0 => ConstructionMethod::File,
|
||||
1 => ConstructionMethod::Idat,
|
||||
2 => return Err(Error::Unsupported("construction_method 'item_offset' is not supported")),
|
||||
_ => return Err(Error::InvalidData("construction_method is taken from the set 0, 1 or 2 per ISOBMFF (ISO 14496-12:2015) § 8.11.3.3"))
|
||||
_ => return Err(Error::InvalidData("construction_method is taken from the set 0, 1 or 2 per ISOBMFF (ISO 14496-12:2020) § 8.11.3.3"))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -3104,7 +3108,7 @@ fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<ItemId, ItemLoc
|
|||
|
||||
if extent_count < 1 {
|
||||
return Err(Error::InvalidData(
|
||||
"extent_count must have a value 1 or greater per ISOBMFF (ISO 14496-12:2015) § 8.11.3.3",
|
||||
"extent_count must have a value 1 or greater per ISOBMFF (ISO 14496-12:2020) § 8.11.3.3",
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -3114,7 +3118,7 @@ fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<ItemId, ItemLoc
|
|||
&& (offset_size == IlocFieldSize::Zero || length_size == IlocFieldSize::Zero)
|
||||
{
|
||||
return Err(Error::InvalidData(
|
||||
"extent_count != 1 requires explicit offset and length per ISOBMFF (ISO 14496-12:2015) § 8.11.3.3",
|
||||
"extent_count != 1 requires explicit offset and length per ISOBMFF (ISO 14496-12:2020) § 8.11.3.3",
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -3130,7 +3134,7 @@ fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<ItemId, ItemLoc
|
|||
}
|
||||
};
|
||||
|
||||
// Per ISOBMFF (ISO 14496-12:2015) § 8.11.3.1:
|
||||
// Per ISOBMFF (ISO 14496-12:2020) § 8.11.3.1:
|
||||
// "If the offset is not identified (the field has a length of zero), then the
|
||||
// beginning of the source (offset 0) is implied"
|
||||
// This behavior will follow from BitReader::read_u64(0) -> 0.
|
||||
|
|
@ -3231,7 +3235,7 @@ pub fn read_mp4<T: Read>(f: &mut T) -> Result<MediaContext> {
|
|||
}
|
||||
|
||||
/// Parse a Movie Header Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.2.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.2.2
|
||||
fn parse_mvhd<T: Read>(f: &mut BMFFBox<T>) -> Result<Option<MediaTimeScale>> {
|
||||
let mvhd = read_mvhd(f)?;
|
||||
debug!("{:?}", mvhd);
|
||||
|
|
@ -3243,7 +3247,7 @@ fn parse_mvhd<T: Read>(f: &mut BMFFBox<T>) -> Result<Option<MediaTimeScale>> {
|
|||
}
|
||||
|
||||
/// Parse a Movie Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.2.1
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.2.1
|
||||
/// Note that despite the spec indicating "exactly one" moov box should exist at
|
||||
/// the file container level, we support reading and merging multiple moov boxes
|
||||
/// such as with tests/test_case_1185230.mp4.
|
||||
|
|
@ -3342,7 +3346,7 @@ fn read_pssh<T: Read>(src: &mut BMFFBox<T>) -> Result<ProtectionSystemSpecificHe
|
|||
}
|
||||
|
||||
/// Parse a Movie Extends Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.8.1
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.8.1
|
||||
fn read_mvex<T: Read>(src: &mut BMFFBox<T>) -> Result<MovieExtendsBox> {
|
||||
let mut iter = src.box_iter();
|
||||
let mut fragment_duration = None;
|
||||
|
|
@ -3369,7 +3373,7 @@ fn read_mehd<T: Read>(src: &mut BMFFBox<T>) -> Result<MediaScaledTime> {
|
|||
}
|
||||
|
||||
/// Parse a Track Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.3.1.
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.3.1.
|
||||
fn read_trak<T: Read>(f: &mut BMFFBox<T>, track: &mut Track) -> Result<()> {
|
||||
let mut iter = f.box_iter();
|
||||
while let Some(mut b) = iter.next_box()? {
|
||||
|
|
@ -3544,7 +3548,7 @@ fn read_stbl<T: Read>(f: &mut BMFFBox<T>, track: &mut Track) -> Result<()> {
|
|||
}
|
||||
|
||||
/// Parse an ftyp box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 4.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 4.3
|
||||
fn read_ftyp<T: Read>(src: &mut BMFFBox<T>) -> Result<FileTypeBox> {
|
||||
let major = be_u32(src)?;
|
||||
let minor = be_u32(src)?;
|
||||
|
|
@ -3650,7 +3654,7 @@ fn read_tkhd<T: Read>(src: &mut BMFFBox<T>) -> Result<TrackHeaderBox> {
|
|||
}
|
||||
|
||||
/// Parse a elst box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.6
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.6.6
|
||||
fn read_elst<T: Read>(src: &mut BMFFBox<T>) -> Result<EditListBox> {
|
||||
let (version, _) = read_fullbox_extra(src)?;
|
||||
let edit_count = be_u32(src)?;
|
||||
|
|
@ -3726,7 +3730,7 @@ fn read_mdhd<T: Read>(src: &mut BMFFBox<T>) -> Result<MediaHeaderBox> {
|
|||
}
|
||||
|
||||
/// Parse a stco box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.5
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.7.5
|
||||
fn read_stco<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let offset_count = be_u32(src)?;
|
||||
|
|
@ -3742,7 +3746,7 @@ fn read_stco<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
|||
}
|
||||
|
||||
/// Parse a co64 box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.5
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.7.5
|
||||
fn read_co64<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let offset_count = be_u32(src)?;
|
||||
|
|
@ -3758,7 +3762,7 @@ fn read_co64<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
|||
}
|
||||
|
||||
/// Parse a stss box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.6.2
|
||||
fn read_stss<T: Read>(src: &mut BMFFBox<T>) -> Result<SyncSampleBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
|
|
@ -3774,7 +3778,7 @@ fn read_stss<T: Read>(src: &mut BMFFBox<T>) -> Result<SyncSampleBox> {
|
|||
}
|
||||
|
||||
/// Parse a stsc box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.4
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.7.4
|
||||
fn read_stsc<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleToChunkBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
|
|
@ -3797,7 +3801,7 @@ fn read_stsc<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleToChunkBox> {
|
|||
}
|
||||
|
||||
/// Parse a Composition Time to Sample Box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.1.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.6.1.3
|
||||
fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
||||
let (version, _) = read_fullbox_extra(src)?;
|
||||
|
||||
|
|
@ -3837,7 +3841,7 @@ fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
|||
}
|
||||
|
||||
/// Parse a stsz box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.3.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.7.3.2
|
||||
fn read_stsz<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleSizeBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_size = be_u32(src)?;
|
||||
|
|
@ -3860,7 +3864,7 @@ fn read_stsz<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleSizeBox> {
|
|||
}
|
||||
|
||||
/// Parse a stts box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.1.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.6.1.2
|
||||
fn read_stts<T: Read>(src: &mut BMFFBox<T>) -> Result<TimeToSampleBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
|
|
@ -4286,7 +4290,7 @@ fn read_dc_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
|
|||
}
|
||||
|
||||
esds.audio_codec = match object_profile {
|
||||
0x40 | 0x41 => CodecType::AAC,
|
||||
0x40 | 0x66 | 0x67 => CodecType::AAC,
|
||||
0x69 | 0x6B => CodecType::MP3,
|
||||
_ => CodecType::Unknown,
|
||||
};
|
||||
|
|
@ -4514,12 +4518,23 @@ fn read_hdlr<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Resu
|
|||
|
||||
match std::str::from_utf8(src.read_into_try_vec()?.as_slice()) {
|
||||
Ok(name) => {
|
||||
if name.bytes().last() != Some(b'\0') {
|
||||
fail_if(
|
||||
match name.bytes().filter(|&b| b == b'\0').count() {
|
||||
0 => fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The HandlerBox 'name' field shall be null-terminated \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?
|
||||
)?,
|
||||
1 => (),
|
||||
_ =>
|
||||
// See https://github.com/MPEGGroup/FileFormat/issues/35
|
||||
{
|
||||
fail_if(
|
||||
strictness == ParseStrictness::Strict,
|
||||
"The HandlerBox 'name' field shall have a NUL byte \
|
||||
only in the final position \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => fail_if(
|
||||
|
|
@ -4693,7 +4708,7 @@ fn read_qt_wave_atom<T: Read>(src: &mut BMFFBox<T>) -> Result<ES_Descriptor> {
|
|||
}
|
||||
|
||||
/// Parse an audio description inside an stsd box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 12.2.3
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 12.2.3
|
||||
fn read_audio_sample_entry<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleEntry> {
|
||||
let name = src.get_header().name;
|
||||
|
||||
|
|
@ -4852,7 +4867,7 @@ fn read_audio_sample_entry<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleEntry>
|
|||
}
|
||||
|
||||
/// Parse a stsd box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.5.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.5.2
|
||||
/// See MP4 (ISO 14496-14:2020) § 6.7.2
|
||||
fn read_stsd<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) -> Result<SampleDescriptionBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
|
|
@ -4994,7 +5009,7 @@ fn read_schm<T: Read>(src: &mut BMFFBox<T>) -> Result<SchemeTypeBox> {
|
|||
}
|
||||
|
||||
/// Parse a metadata box inside a moov, trak, or mdia box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.10.1.
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.10.1.
|
||||
fn read_udta<T: Read>(src: &mut BMFFBox<T>) -> Result<UserdataBox> {
|
||||
let mut iter = src.box_iter();
|
||||
let mut udta = UserdataBox { meta: None };
|
||||
|
|
@ -5013,7 +5028,7 @@ fn read_udta<T: Read>(src: &mut BMFFBox<T>) -> Result<UserdataBox> {
|
|||
}
|
||||
|
||||
/// Parse the meta box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.111.
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.1
|
||||
fn read_meta<T: Read>(src: &mut BMFFBox<T>) -> Result<MetadataBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let mut iter = src.box_iter();
|
||||
|
|
@ -5033,7 +5048,7 @@ fn read_meta<T: Read>(src: &mut BMFFBox<T>) -> Result<MetadataBox> {
|
|||
}
|
||||
|
||||
/// Parse a XML box inside a meta box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.2
|
||||
#[cfg(feature = "meta-xml")]
|
||||
fn read_xml_<T: Read>(src: &mut BMFFBox<T>, meta: &mut MetadataBox) -> Result<()> {
|
||||
if read_fullbox_version_no_flags(src)? != 0 {
|
||||
|
|
@ -5044,7 +5059,7 @@ fn read_xml_<T: Read>(src: &mut BMFFBox<T>, meta: &mut MetadataBox) -> Result<()
|
|||
}
|
||||
|
||||
/// Parse a Binary XML box inside a meta box
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.2
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.11.2
|
||||
#[cfg(feature = "meta-xml")]
|
||||
fn read_bxml<T: Read>(src: &mut BMFFBox<T>, meta: &mut MetadataBox) -> Result<()> {
|
||||
if read_fullbox_version_no_flags(src)? != 0 {
|
||||
|
|
|
|||
47
third_party/rust/mp4parse/src/tests.rs
vendored
47
third_party/rust/mp4parse/src/tests.rs
vendored
|
|
@ -475,6 +475,24 @@ fn read_hdlr() {
|
|||
assert_eq!(parsed.handler_type, b"vide");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_multiple_nul_in_name() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(45), b"hdlr", 0, |s| {
|
||||
s.B32(0)
|
||||
.append_bytes(b"vide")
|
||||
.B32(0)
|
||||
.B32(0)
|
||||
.B32(0)
|
||||
.append_bytes(b"Vide\0Handler")
|
||||
.B8(0) // null-terminate string
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 45);
|
||||
assert!(super::read_hdlr(&mut stream, ParseStrictness::Strict).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_short_name() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(33), b"hdlr", 0, |s| {
|
||||
|
|
@ -1060,6 +1078,35 @@ fn read_esds_aac_type5() {
|
|||
assert_eq!(es.decoder_specific_data, aac_dc_descriptor);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_esds_mpeg2_aac_lc() {
|
||||
// Recognize MPEG-2 AAC LC (ISO 13818-7) object type as AAC.
|
||||
// Extracted from BMO #1722497 sdasdasdasd_001.mp4 using Bento4.
|
||||
// "mp4extract --payload-only moov/trak[1]/mdia/minf/stbl/stsd/mp4a/esds sdasdasdasd_001.mp4 /dev/stdout | xxd -i -c 15"
|
||||
let aac_esds = vec![
|
||||
0x03, 0x19, 0x00, 0x00, 0x00, 0x04, 0x11, 0x67, 0x15, 0x00, 0x02, 0x38, 0x00, 0x01, 0x0f,
|
||||
0xd0, 0x00, 0x00, 0xf5, 0x48, 0x05, 0x02, 0x13, 0x90, 0x06, 0x01, 0x02,
|
||||
];
|
||||
let aac_dc_descriptor = &aac_esds[22..24];
|
||||
|
||||
let mut stream = make_box(BoxSize::Auto, b"esds", |s| {
|
||||
s.B32(0) // reserved
|
||||
.append_bytes(aac_esds.as_slice())
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
|
||||
let es = super::read_esds(&mut stream).unwrap();
|
||||
|
||||
assert_eq!(es.audio_codec, super::CodecType::AAC);
|
||||
assert_eq!(es.audio_object_type, Some(2));
|
||||
assert_eq!(es.extended_audio_object_type, None);
|
||||
assert_eq!(es.audio_sample_rate, Some(22050));
|
||||
assert_eq!(es.audio_channel_count, Some(2));
|
||||
assert_eq!(es.codec_esds, aac_esds);
|
||||
assert_eq!(es.decoder_specific_data, aac_dc_descriptor);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_stsd_mp4v() {
|
||||
let mp4v = vec![
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"fa0e2b46e9547dba9134da4001b2cd803fac58f9252394aa62653fe99bd220fa","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"f776ed4bbb7b58a5684402a9c5c28dfe1fa02b6b184139b2c2c49384cc1e3723","cbindgen.toml":"f82065edc5be3d2e43db65ac67490194701b3800ce3d42976fc7ad351928a296","examples/dump.rs":"268093925d28d1636e106d93a2f2917fb1d7ddaf04ecd70880e1551fb578de1a","src/lib.rs":"9bec128eb9ac71a79e20a5e2c7125579baab921d285fb897ed04525df4ab9827","tests/test_chunk_out_of_range.rs":"b5da583218d98027ed973a29c67434a91a1306f2d2fb39ec4d640d4824c308ce","tests/test_encryption.rs":"b918f0f10e7708bff5fae4becf1d09a188db25d874d0919d509b90266504eed7","tests/test_fragment.rs":"e90eb5a4418d30002655466c0c4b3125c7fd70a74b6871471eaa172f1def9db8","tests/test_rotation.rs":"fb43c2f2dfa496d151c33bdd46c0fd3252387c23cc71e2cac9ed0234de715a81","tests/test_sample_table.rs":"19b8d0b0f7ed79a857329321b49f5a7f687901cadd4cd22bc6728febd919d3ce","tests/test_workaround_stsc.rs":"7dd419f3d55b9a3a039cac57e58a9240a9c8166bcd4356c24f69f731c3ced83b"},"package":null}
|
||||
{"files":{"Cargo.toml":"a01dabf060b9e93415361370add87e1ab1170a4a94f93fd24c9f95fc4e004f48","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"f776ed4bbb7b58a5684402a9c5c28dfe1fa02b6b184139b2c2c49384cc1e3723","cbindgen.toml":"28c98f1dd0f4ec6ff0f4acbc86d4112d2a3569306b55baf84727f5e8c769b15d","examples/dump.rs":"a22630f5f1434d4832f9113dcb18161c0248465e8844d470da3c76bb9910677a","src/lib.rs":"dc0d0af89fceb7cce359fc581b00b211fdd8f70bc8e120157d1ef636d38cbcd1","tests/test_chunk_out_of_range.rs":"73ffb5b60e826f6136d22142c030d17d0f72b85c675ccbf1300c84f9deb73131","tests/test_encryption.rs":"196ba22efc3e693c940bcc1e45d29bec9cf290b81cf77a68c1d254f6b38e6ae3","tests/test_fragment.rs":"a4b275d7159c50b265db583a1cc8255bd0a141e3a44432355713b895a7970d37","tests/test_rotation.rs":"a5aa6cc88a327ec90d6898b2c4f5ac397667ce349d829deae1af46c230be9cb6","tests/test_sample_table.rs":"d191fe5836c58d4bdffd7390da029bb5371f8afb5b1a8d636e15ae0dd6b5f4c8","tests/test_workaround_stsc.rs":"85cd2546224b5c4891a60d86e2d302a56e0c0798c2636ad241603a00ebfa46b5"},"package":null}
|
||||
4
third_party/rust/mp4parse_capi/Cargo.toml
vendored
4
third_party/rust/mp4parse_capi/Cargo.toml
vendored
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mp4parse_capi"
|
||||
version = "0.11.5"
|
||||
version = "0.12.0"
|
||||
authors = [
|
||||
"Ralph Giles <giles@mozilla.com>",
|
||||
"Matthew Gregan <kinetik@flim.org>",
|
||||
|
|
@ -27,7 +27,7 @@ travis-ci = { repository = "https://github.com/mozilla/mp4parse-rust" }
|
|||
byteorder = "1.2.1"
|
||||
fallible_collections = { version = "0.4", features = ["std_io"] }
|
||||
log = "0.4"
|
||||
mp4parse = { version = "0.11.5", path = "../mp4parse", features = ["unstable-api"] }
|
||||
mp4parse = { version = "0.12.0", path = "../mp4parse", features = ["unstable-api"] }
|
||||
num-traits = "0.2.14"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
|||
1
third_party/rust/mp4parse_capi/cbindgen.toml
vendored
1
third_party/rust/mp4parse_capi/cbindgen.toml
vendored
|
|
@ -40,3 +40,4 @@ include = ["Status"]
|
|||
"ImageRotation" = "Mp4parseIrot"
|
||||
"ImageMirror" = "Mp4parseImir"
|
||||
"Indice" = "Mp4parseIndice"
|
||||
"NclxColourInformation" = "Mp4parseNclxColourInformation"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
11
third_party/rust/mp4parse_capi/src/lib.rs
vendored
11
third_party/rust/mp4parse_capi/src/lib.rs
vendored
|
|
@ -1287,12 +1287,7 @@ fn get_pssh_info(
|
|||
.try_into()
|
||||
.map_err(|_| Mp4parseStatus::Invalid)?;
|
||||
let mut data_len = TryVec::new();
|
||||
if data_len
|
||||
.write_u32::<byteorder::NativeEndian>(content_len)
|
||||
.is_err()
|
||||
{
|
||||
return Err(Mp4parseStatus::Io);
|
||||
}
|
||||
data_len.write_u32::<byteorder::NativeEndian>(content_len)?;
|
||||
pssh_data.extend_from_slice(pssh.system_id.as_slice())?;
|
||||
pssh_data.extend_from_slice(data_len.as_slice())?;
|
||||
pssh_data.extend_from_slice(pssh.box_content.as_slice())?;
|
||||
|
|
@ -1312,8 +1307,8 @@ extern "C" fn error_read(_: *mut u8, _: usize, _: *mut std::os::raw::c_void) ->
|
|||
extern "C" fn valid_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::io::Read;
|
|||
|
||||
extern "C" fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
|
||||
let input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
|
||||
let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(&mut buf) {
|
||||
let buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
|
||||
match input.read(buf) {
|
||||
Ok(n) => n as isize,
|
||||
Err(_) => -1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ description = "Shared Rust code for libxul"
|
|||
geckoservo = { path = "../../../../servo/ports/geckolib" }
|
||||
kvstore = { path = "../../../components/kvstore" }
|
||||
lmdb-rkv-sys = { version = "0.11", features = ["mdb_idl_logn_9"] }
|
||||
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "72eb355ddeada541d7e57dbe5fb60eb5124dea0d", features = ["missing-pixi-permitted"] }
|
||||
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "a25713781eac774c531af43ba833ef86cb920889", features = ["missing-pixi-permitted"] }
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
|
||||
|
|
|
|||
Loading…
Reference in a new issue