Fix cosmic-player file launch and video playback
Some checks failed
Validate .desktop files / validate (push) Has been cancelled
Some checks failed
Validate .desktop files / validate (push) Has been cancelled
This commit is contained in:
parent
4a1bfc975c
commit
e7781986f5
5 changed files with 67 additions and 22 deletions
31
src/video.rs
31
src/video.rs
|
|
@ -16,11 +16,17 @@ pub fn new_video(
|
|||
//TODO: this code came from iced_video_player::Video::new and has been modified to stop the pipeline on error
|
||||
//TODO: remove unwraps and enable playback of files with only audio.
|
||||
gst::init().unwrap();
|
||||
disable_broken_hardware_decoders();
|
||||
|
||||
let pipeline = format!(
|
||||
"playbin uri=\"{}\"{} video-sink=\"videoscale ! videoconvert ! videoflip method=automatic ! appsink name=iced_video drop=true caps=video/x-raw,format=NV12,pixel-aspect-ratio=1/1\"",
|
||||
"playbin uri=\"{}\"{}{} video-sink=\"videoscale ! videoconvert ! videoflip method=automatic ! appsink name=iced_video drop=true caps=video/x-raw,format=NV12,pixel-aspect-ratio=1/1\"",
|
||||
url.as_str(),
|
||||
if settings.mute { " mute=true" } else { "" }
|
||||
if settings.mute { " mute=true" } else { "" },
|
||||
if settings.mute {
|
||||
" audio-sink=fakesink"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
let pipeline = gst::parse::launch(pipeline.as_ref())
|
||||
.unwrap()
|
||||
|
|
@ -84,3 +90,24 @@ pub fn new_video(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn disable_broken_hardware_decoders() {
|
||||
let registry = gst::Registry::get();
|
||||
for decoder in [
|
||||
"nvav1dec",
|
||||
"nvh264dec",
|
||||
"nvh265dec",
|
||||
"nvjpegdec",
|
||||
"nvmpeg2videodec",
|
||||
"nvmpeg4videodec",
|
||||
"nvmpegvideodec",
|
||||
"nvvp8dec",
|
||||
"nvvp9dec",
|
||||
] {
|
||||
if let Some(feature) = registry.lookup_feature(decoder) {
|
||||
let rank = feature.rank();
|
||||
feature.set_rank(gst::Rank::NONE);
|
||||
log::debug!("disabled GStreamer decoder {decoder} with rank {rank:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue