Skip to content

Commit b31d94b

Browse files
authored
Merge pull request #327 from mozilla/no-pixi-permitted
Add "missing-pixi-permitted" feature
2 parents ea0e19e + 891df7c commit b31d94b

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
name: Build Rust ${{ matrix.rust }} on ${{ matrix.os }}, release=${{ matrix.release }}
11+
name: Build Rust ${{ matrix.rust }} on ${{ matrix.os }}, release=${{ matrix.release }} features=${{ matrix.features }}
1212
runs-on: ${{ matrix.os }}
1313
continue-on-error: ${{ matrix.experimental }}
1414
strategy:
@@ -18,6 +18,7 @@ jobs:
1818
rust: [stable]
1919
release: [true, false]
2020
experimental: [false]
21+
features: ["", "missing-pixi-permitted"]
2122
include:
2223
- os: ubuntu-20.04
2324
rust: nightly
@@ -54,12 +55,12 @@ jobs:
5455

5556
- name: Test (release)
5657
shell: bash
57-
run: rustup run ${{ matrix.rust }} cargo test --all --verbose --release
58+
run: rustup run ${{ matrix.rust }} cargo test --all --features "${{ matrix.features }}" --verbose --release
5859
if: matrix.release
5960

6061
- name: Test (debug)
6162
shell: bash
62-
run: rustup run ${{ matrix.rust }} cargo test --all --verbose
63+
run: rustup run ${{ matrix.rust }} cargo test --all --features "${{ matrix.features }}" --verbose
6364
if: ${{ !matrix.release }}
6465

6566
- name: Doc (release)

mp4parse/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ walkdir = "2.3.1"
4040
criterion = "0.3"
4141

4242
[features]
43+
missing-pixi-permitted = []
4344
3gpp = []
4445
meta-xml = []
4546
unstable-api = []

mp4parse/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,8 +1710,16 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
17101710
.map_or(false, |opt| opt.is_some())
17111711
};
17121712
if !has_pixi(primary_item_id) || !alpha_item_id.map_or(true, has_pixi) {
1713+
// The requirement to include pixi is in the process of being changed
1714+
// to allowing its omission to imply a default value. In anticipation
1715+
// of that, only give an error in strict mode
1716+
// See https://github.com/MPEGGroup/MIAF/issues/9
17131717
fail_if(
1714-
strictness != ParseStrictness::Permissive,
1718+
if cfg!(feature = "missing-pixi-permitted") {
1719+
strictness == ParseStrictness::Strict
1720+
} else {
1721+
strictness != ParseStrictness::Permissive
1722+
},
17151723
"The pixel information property shall be associated with every image \
17161724
that is displayable (not hidden) \
17171725
per MIAF (ISO/IEC 23000-22:2019) specification § 7.3.6.6",

mp4parse/tests/public.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,14 @@ fn public_avif_pixi_present_for_displayable_images() {
923923
let expected_msg = "The pixel information property shall be associated with every image \
924924
that is displayable (not hidden) \
925925
per MIAF (ISO/IEC 23000-22:2019) specification § 7.3.6.6";
926-
assert_avif_shall(IMAGE_AVIF_NO_PIXI, expected_msg);
927-
assert_avif_shall(IMAGE_AVIF_NO_ALPHA_PIXI, expected_msg);
926+
let pixi_test = if cfg!(feature = "missing-pixi-permitted") {
927+
assert_avif_should
928+
} else {
929+
assert_avif_shall
930+
};
931+
932+
pixi_test(IMAGE_AVIF_NO_PIXI, expected_msg);
933+
pixi_test(IMAGE_AVIF_NO_ALPHA_PIXI, expected_msg);
928934
}
929935

930936
#[test]

mp4parse_capi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ num-traits = "0.2.14"
3434
env_logger = "0.8"
3535

3636
[features]
37+
missing-pixi-permitted = ["mp4parse/missing-pixi-permitted"]
3738
3gpp = ["mp4parse/3gpp"]
3839
meta-xml = ["mp4parse/meta-xml"]
3940
mp4v = ["mp4parse/mp4v"]

0 commit comments

Comments
 (0)