Handle codec install during file open, fixes #23
This commit is contained in:
parent
21866486bd
commit
0e0718e45d
1 changed files with 22 additions and 1 deletions
23
src/main.rs
23
src/main.rs
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue