Handle codec install during file open, fixes #23

This commit is contained in:
Jeremy Soller 2025-08-14 20:31:47 -06:00
parent 21866486bd
commit 0e0718e45d
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA

View file

@ -374,8 +374,29 @@ impl App {
Ok(ok) => ok,
Err(err) => {
log::warn!("failed to open {}: {err}", url);
// Handle codecs required before the file can play
let mut commands = Vec::new();
while let Some(msg) = pipeline
.bus()
.unwrap()
.pop_filtered(&[gst::MessageType::Element])
{
match msg.view() {
gst::MessageView::Element(element) => {
if gst_pbutils::MissingPluginMessage::is(&element) {
commands.push(Command::perform(
async { message::app(Message::MissingPlugin(msg)) },
|x| x,
));
// Do one codec install at a time
break;
}
}
_ => {}
}
}
pipeline.set_state(gst::State::Null).unwrap();
return Command::none();
return Command::batch(commands);
}
}
};