Compare commits
3 commits
22e5890a7c
...
a670d2afd7
| Author | SHA1 | Date | |
|---|---|---|---|
| a670d2afd7 | |||
| fd03f98738 | |||
| 1e0a8add0f |
6 changed files with 104 additions and 5 deletions
70
redeploy.sh
Executable file
70
redeploy.sh
Executable file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Rebuild and deploy the local COSMIC Media Player fork.
|
||||||
|
#
|
||||||
|
# Keep this binary in /usr/local/bin so it intentionally overrides the packaged
|
||||||
|
# /usr/bin/cosmic-player, but only after rebuilding from the current local
|
||||||
|
# source tree.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REPO="${COSMIC_PLAYER_REPO:-/home/lionel/Projets/COSMIC/cosmic-player}"
|
||||||
|
TOOLCHAIN="${COSMIC_RUST_TOOLCHAIN:-1.93.0}"
|
||||||
|
PREFIX="${COSMIC_LOCAL_PREFIX:-/usr/local}"
|
||||||
|
APPID="com.system76.CosmicPlayer"
|
||||||
|
BIN_NAME="cosmic-player"
|
||||||
|
|
||||||
|
cd "$REPO"
|
||||||
|
|
||||||
|
echo "==> Repository: $REPO"
|
||||||
|
echo "==> Branch: $(git branch --show-current 2>/dev/null || echo unknown)"
|
||||||
|
echo "==> Build release with Rust $TOOLCHAIN"
|
||||||
|
cargo "+$TOOLCHAIN" build --release
|
||||||
|
|
||||||
|
bin_built="$REPO/target/release/$BIN_NAME"
|
||||||
|
bin_target="$PREFIX/bin/$BIN_NAME"
|
||||||
|
|
||||||
|
if [[ -e "$bin_target" ]]; then
|
||||||
|
backup="${bin_target}.bak.$(date +%Y%m%d-%H%M%S)"
|
||||||
|
echo "==> Backup $bin_target -> $backup"
|
||||||
|
sudo cp -a "$bin_target" "$backup"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Install binary"
|
||||||
|
sudo install -Dm0755 "$bin_built" "$bin_target"
|
||||||
|
|
||||||
|
echo "==> Install desktop integration"
|
||||||
|
sudo install -Dm0644 "target/xdgen/$APPID.desktop" "$PREFIX/share/applications/$APPID.desktop"
|
||||||
|
sudo install -Dm0644 "target/xdgen/$APPID.metainfo.xml" "$PREFIX/share/metainfo/$APPID.metainfo.xml"
|
||||||
|
sudo install -Dm0644 "res/$APPID.thumbnailer" "$PREFIX/share/thumbnailers/$APPID.thumbnailer"
|
||||||
|
|
||||||
|
while IFS= read -r icon; do
|
||||||
|
rel="${icon#res/icons/hicolor/}"
|
||||||
|
sudo install -Dm0644 "$icon" "$PREFIX/share/icons/hicolor/$rel"
|
||||||
|
done < <(find "res/icons/hicolor" -type f -name "$APPID.svg" | sort)
|
||||||
|
|
||||||
|
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||||
|
echo "==> Refresh desktop database"
|
||||||
|
if [[ -w "$PREFIX/share/applications" ]]; then
|
||||||
|
update-desktop-database "$PREFIX/share/applications" || true
|
||||||
|
else
|
||||||
|
sudo -n update-desktop-database "$PREFIX/share/applications" 2>/dev/null || \
|
||||||
|
echo " skipped: sudo authentication required"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v xdg-mime >/dev/null 2>&1; then
|
||||||
|
echo "==> Register common legacy video defaults"
|
||||||
|
xdg-mime default "$APPID.desktop" \
|
||||||
|
video/mpeg \
|
||||||
|
video/x-mpeg \
|
||||||
|
video/x-mpeg2 \
|
||||||
|
video/x-ms-wmv \
|
||||||
|
video/x-ms-wm \
|
||||||
|
video/x-ms-asf \
|
||||||
|
application/vnd.ms-asf
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Installed version"
|
||||||
|
"$bin_target" --version
|
||||||
|
|
||||||
|
echo "OK - COSMIC Media Player rebuilt and redeployed."
|
||||||
|
|
@ -33,6 +33,7 @@ mod config;
|
||||||
mod key_bind;
|
mod key_bind;
|
||||||
mod localize;
|
mod localize;
|
||||||
mod menu;
|
mod menu;
|
||||||
|
mod mime;
|
||||||
#[cfg(feature = "mpris-server")]
|
#[cfg(feature = "mpris-server")]
|
||||||
mod mpris;
|
mod mpris;
|
||||||
mod project;
|
mod project;
|
||||||
|
|
|
||||||
27
src/mime.rs
Normal file
27
src/mime.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
const DESKTOP_ENTRY: &str = include_str!("../res/com.system76.CosmicPlayer.desktop");
|
||||||
|
|
||||||
|
pub fn supported_mime_types() -> Vec<String> {
|
||||||
|
DESKTOP_ENTRY
|
||||||
|
.lines()
|
||||||
|
.find_map(|line| line.strip_prefix("MimeType="))
|
||||||
|
.map(|mime_types| {
|
||||||
|
mime_types
|
||||||
|
.split(';')
|
||||||
|
.filter(|mime_type| !mime_type.is_empty())
|
||||||
|
.map(ToOwned::to_owned)
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn supported_uri_schemes() -> Vec<String> {
|
||||||
|
supported_mime_types()
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|mime_type| {
|
||||||
|
mime_type
|
||||||
|
.strip_prefix("x-scheme-handler/")
|
||||||
|
.map(ToOwned::to_owned)
|
||||||
|
})
|
||||||
|
.chain(["file".to_string(), "http".to_string(), "https".to_string()])
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
@ -138,12 +138,12 @@ impl RootInterface for Player {
|
||||||
|
|
||||||
async fn supported_uri_schemes(&self) -> fdo::Result<Vec<String>> {
|
async fn supported_uri_schemes(&self) -> fdo::Result<Vec<String>> {
|
||||||
log::info!("SupportedUriSchemes");
|
log::info!("SupportedUriSchemes");
|
||||||
Ok(vec![])
|
Ok(crate::mime::supported_uri_schemes())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn supported_mime_types(&self) -> fdo::Result<Vec<String>> {
|
async fn supported_mime_types(&self) -> fdo::Result<Vec<String>> {
|
||||||
log::info!("SupportedMimeTypes");
|
log::info!("SupportedMimeTypes");
|
||||||
Ok(vec![])
|
Ok(crate::mime::supported_mime_types())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
vendor/iced_video_player/src/pipeline.rs
vendored
4
vendor/iced_video_player/src/pipeline.rs
vendored
|
|
@ -32,7 +32,7 @@ pub struct VideoPipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VideoPipeline {
|
impl VideoPipeline {
|
||||||
fn new(device: &wgpu::Device, format: wgpu::TextureFormat, queue: &wgpu::Queue) -> Self {
|
fn new(device: &wgpu::Device, format: wgpu::TextureFormat, _queue: &wgpu::Queue) -> Self {
|
||||||
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
||||||
label: Some("iced_video_player shader"),
|
label: Some("iced_video_player shader"),
|
||||||
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
|
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
|
||||||
|
|
@ -417,7 +417,7 @@ impl Primitive for VideoPrimitive {
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
queue: &wgpu::Queue,
|
queue: &wgpu::Queue,
|
||||||
bounds: &Rectangle,
|
bounds: &Rectangle,
|
||||||
viewport: &Viewport,
|
_viewport: &Viewport,
|
||||||
) {
|
) {
|
||||||
if self.upload_frame {
|
if self.upload_frame {
|
||||||
if let Some(readable) = self.frame.lock().expect("lock frame mutex").readable() {
|
if let Some(readable) = self.frame.lock().expect("lock frame mutex").readable() {
|
||||||
|
|
|
||||||
3
vendor/iced_video_player/src/video.rs
vendored
3
vendor/iced_video_player/src/video.rs
vendored
|
|
@ -50,6 +50,7 @@ impl Frame {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(gst::Sample::builder().build())
|
Self(gst::Sample::builder().build())
|
||||||
}
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn store(&mut self, sample: gst::Sample) -> Option<()> {
|
pub fn store(&mut self, sample: gst::Sample) -> Option<()> {
|
||||||
if sample.buffer().is_some() {
|
if sample.buffer().is_some() {
|
||||||
self.0 = sample;
|
self.0 = sample;
|
||||||
|
|
@ -58,7 +59,7 @@ impl Frame {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn readable(&self) -> Option<gst::BufferMap<gst::buffer::Readable>> {
|
pub fn readable(&self) -> Option<gst::BufferMap<'_, gst::buffer::Readable>> {
|
||||||
self.0.buffer().map(|x| x.map_readable().ok()).flatten()
|
self.0.buffer().map(|x| x.map_readable().ok()).flatten()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue