-
Notifications
You must be signed in to change notification settings - Fork 6
image::Decoder fails to detect several format where the individual decoders succeeds in creation #40
Description
Hi,
This is to report that in image-extras the following formats fail at ImageReader::into_decoder() but creating individual Decoder instances do succeed:
- WBMP
- PCX
- SGI
- XPM
Like #39 and image-rs/image#2892 the template for validating MIME type I'm using is as follows:
fn type_find(typefind: &mut gst::TypeFind) {
use gst::{Caps, TypeFindProbability};
let cursor = std::io::BufReader::new(W::from(&mut *typefind));
if let Ok(decoder) = image_extras::wbmp::WbmpDecoder::new(cursor) {
let d = decoder.dimensions();
gst::log!(
CAT,
"extracted WAP bitmap width and height: {}x{}",
d.0,
d.1
);
typefind.suggest(
TypeFindProbability::Maximum,
&Caps::builder("image/vnd.wap.wbmp").build(),
);
}
}Tthe following is the piece of GStreamer code creating the decoder instance, ImageFormat is my own wrapper over image::Format, which will fail casting if the format doesn't have a valid enum:
let mut reader = ImageReader::new(source);
let format = state
.format_from_caps
.ok_or(gst::FlowError::NotNegotiated)?;
if let Ok(v) = ImageFormat::try_from(format) {
reader.set_format(v);
}
if settings.max_alloc != 0 {
let mut limits = Limits::default();
limits.max_alloc = Some(settings.max_alloc);
reader.limits(limits);
}
drop(settings);
let mut decoder = reader.into_decoder().map_err(|v| {
gst::error!(CAT, imp = self, "Failed decoding single image: {v}");
gst::FlowError::Error
})?;All of the formats above return the same error 0:00:00.639300000 18504 21532 ERROR imagersdec video\image\src\decoder\imp.rs:286:gstimagers::decoder::imp::Decoder::render_single_frame::{{closure}}:<imagersdecoder0> Failed decoding single image: The image format could not be determined.
This should not be possible because the typefinding functions have already created a decoder for the supplied files and read basic metadata.
I attach samples for the above formats. All of them were sourced from known working sites, in particular https://resources.oreilly.com/examples/9781565920583/-/tree/master/CDROM/GFF/SAMPLE/IMAGES/SGIIMAGE, https://people.math.sc.edu/Burkardt/data/pcx/pcx.html, and the corresponding entries in Archiveteam e.g. http://justsolve.archiveteam.org/wiki/WBMP.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status