@@ -1640,6 +1640,37 @@ impl AvifContext {
16401640 }
16411641 }
16421642
1643+ pub fn av1_config ( & self ) -> Result < & AV1ConfigBox > {
1644+ if let Some ( primary_item) = & self . primary_item {
1645+ match self
1646+ . item_properties
1647+ . get ( primary_item. id , BoxType :: AV1CodecConfigurationBox ) ?
1648+ {
1649+ Some ( ItemProperty :: AV1Config ( av1c) ) => Ok ( av1c) ,
1650+ Some ( other_property) => panic ! ( "property key mismatch: {:?}" , other_property) ,
1651+ None => Err ( Error :: from ( Status :: Av1cMissing ) ) ,
1652+ }
1653+ } else {
1654+ Err ( Error :: from ( Status :: PitmMissing ) )
1655+ }
1656+ }
1657+
1658+
1659+ pub fn spatial_extents ( & self ) -> Result < & ImageSpatialExtentsProperty > {
1660+ if let Some ( primary_item) = & self . primary_item {
1661+ match self
1662+ . item_properties
1663+ . get ( primary_item. id , BoxType :: ImageSpatialExtentsProperty ) ?
1664+ {
1665+ Some ( ItemProperty :: ImageSpatialExtents ( ispe) ) => Ok ( ispe) ,
1666+ Some ( other_property) => panic ! ( "property key mismatch: {:?}" , other_property) ,
1667+ None => Err ( Error :: from ( Status :: IspeMissing ) ) ,
1668+ }
1669+ } else {
1670+ Err ( Error :: from ( Status :: PitmMissing ) )
1671+ }
1672+ }
1673+
16431674 pub fn spatial_extents_ptr ( & self ) -> Result < * const ImageSpatialExtentsProperty > {
16441675 if let Some ( primary_item) = & self . primary_item {
16451676 match self
@@ -1661,6 +1692,21 @@ impl AvifContext {
16611692 }
16621693 }
16631694
1695+ pub fn colour_information ( & self ) -> Result < & ColourInformation > {
1696+ if let Some ( primary_item) = & self . primary_item {
1697+ match self
1698+ . item_properties
1699+ . get ( primary_item. id , BoxType :: ColourInformationBox ) ?
1700+ {
1701+ Some ( ItemProperty :: Colour ( v) ) => Ok ( v) ,
1702+ Some ( other_property) => panic ! ( "property key mismatch: {:?}" , other_property) ,
1703+ None => Err ( Error :: from ( Status :: ItemTypeMissing ) ) ,
1704+ }
1705+ } else {
1706+ Err ( Error :: from ( Status :: PitmMissing ) )
1707+ }
1708+ }
1709+
16641710 /// Returns None if there is no primary item or it has no associated NCLX colour boxes.
16651711 pub fn nclx_colour_information_ptr ( & self ) -> Option < Result < * const NclxColourInformation > > {
16661712 if let Some ( primary_item) = & self . primary_item {
@@ -1722,6 +1768,21 @@ impl AvifContext {
17221768 }
17231769 }
17241770
1771+ pub fn image_mirror ( & self ) -> Result < & ImageMirror > {
1772+ if let Some ( primary_item) = & self . primary_item {
1773+ match self
1774+ . item_properties
1775+ . get ( primary_item. id , BoxType :: ImageMirror ) ?
1776+ {
1777+ Some ( ItemProperty :: Mirroring ( imir) ) => Ok ( imir) ,
1778+ Some ( other_property) => panic ! ( "property key mismatch: {:?}" , other_property) ,
1779+ None => Err ( Error :: from ( Status :: ItemTypeMissing ) ) ,
1780+ }
1781+ } else {
1782+ Err ( Error :: from ( Status :: PitmMissing ) )
1783+ }
1784+ }
1785+
17251786 pub fn image_mirror_ptr ( & self ) -> Result < * const ImageMirror > {
17261787 if let Some ( primary_item) = & self . primary_item {
17271788 match self
@@ -1737,6 +1798,21 @@ impl AvifContext {
17371798 }
17381799 }
17391800
1801+ pub fn pixel_aspect_ratio ( & self ) -> Result < & PixelAspectRatio > {
1802+ if let Some ( primary_item) = & self . primary_item {
1803+ match self
1804+ . item_properties
1805+ . get ( primary_item. id , BoxType :: PixelAspectRatioBox ) ?
1806+ {
1807+ Some ( ItemProperty :: PixelAspectRatio ( pasp) ) => Ok ( pasp) ,
1808+ Some ( other_property) => panic ! ( "property key mismatch: {:?}" , other_property) ,
1809+ None => Err ( Error :: from ( Status :: ItemTypeMissing ) ) ,
1810+ }
1811+ } else {
1812+ Err ( Error :: from ( Status :: PitmMissing ) )
1813+ }
1814+ }
1815+
17401816 pub fn pixel_aspect_ratio_ptr ( & self ) -> Result < * const PixelAspectRatio > {
17411817 if let Some ( primary_item) = & self . primary_item {
17421818 match self
@@ -3645,8 +3721,8 @@ fn read_ipco<T: Read>(
36453721#[ repr( C ) ]
36463722#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
36473723pub struct ImageSpatialExtentsProperty {
3648- image_width : u32 ,
3649- image_height : u32 ,
3724+ pub image_width : u32 ,
3725+ pub image_height : u32 ,
36503726}
36513727
36523728/// Parse image spatial extents property
@@ -3669,8 +3745,8 @@ fn read_ispe<T: Read>(src: &mut BMFFBox<T>) -> Result<ImageSpatialExtentsPropert
36693745#[ repr( C ) ]
36703746#[ derive( Debug ) ]
36713747pub struct PixelAspectRatio {
3672- h_spacing : u32 ,
3673- v_spacing : u32 ,
3748+ pub h_spacing : u32 ,
3749+ pub v_spacing : u32 ,
36743750}
36753751
36763752/// Parse pixel aspect ratio property
@@ -3722,16 +3798,16 @@ fn read_pixi<T: Read>(src: &mut BMFFBox<T>) -> Result<PixelInformation> {
37223798#[ repr( C ) ]
37233799#[ derive( Debug ) ]
37243800pub struct NclxColourInformation {
3725- colour_primaries : u8 ,
3726- transfer_characteristics : u8 ,
3727- matrix_coefficients : u8 ,
3728- full_range_flag : bool ,
3801+ pub colour_primaries : u8 ,
3802+ pub transfer_characteristics : u8 ,
3803+ pub matrix_coefficients : u8 ,
3804+ pub full_range_flag : bool ,
37293805}
37303806
37313807/// The raw bytes of the ICC profile
37323808#[ repr( C ) ]
37333809pub struct IccColourInformation {
3734- bytes : TryVec < u8 > ,
3810+ pub bytes : TryVec < u8 > ,
37353811}
37363812
37373813impl fmt:: Debug for IccColourInformation {
0 commit comments