Skip to content

ftyp compatiblity list values #45

@bradh

Description

@bradh

We currently return the compatibility list as a vector of String:

jpeg2000/jp2/src/lib.rs

Lines 326 to 332 in 0130714

// This field is encoded as a four byte string of ISO 646 characters.
pub fn compatibility_list(&self) -> Vec<String> {
self.compatibility_list
.iter()
.map(|c| str::from_utf8(c).unwrap().to_owned())
.collect()
}

There is data that won't quite map across, such as most of the samples. They have two entries in the list, one of which looks like 0x00 0x00 0x00 0x01:

0000000 00 00 00 0c 6a 50 20 20 0d 0a 87 0a 00 00 00 18  >....jP  ........<
0000020 66 74 79 70 6a 70 32 20 00 00 00 00 00 00 00 01  >ftypjp2 ........<
0000040 6a 70 32 20 00 00 01 b7 78 6d 6c 20 3c 3f 78 6d  >jp2 ....xml <?xm<

I think that is marginal for compliance. Its not really a string of ISO 646 characters, but it is in the range of values given in Table I.4 for CLi.

In any case, its in the data.

So options:

  1. Change the API to return vector of [u8;4] instead of String
  2. Add API to return vector of [u8;4], while keeping existing API
  3. Change the API to return vector of u32 instead of String
  4. Add API to return vector of u32, while keeping existing API
  5. Ignore the weird value on parsing
  6. Ignore the weird value if it looks like a count of the remaining entries.
  7. Something else

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions