Write a demo app that plays the gstreamer test video
This commit is contained in:
parent
f8fdaf2892
commit
ee56513299
File diff suppressed because it is too large
Load Diff
|
@ -20,16 +20,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704732714,
|
||||
"narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=",
|
||||
"lastModified": 1724316499,
|
||||
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3",
|
||||
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-24.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
description = "Lumenescent Dreams Tools";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
unstable.url = "nixpkgs/nixos-unstable";
|
||||
typeshare.url = "github:1Password/typeshare";
|
||||
};
|
||||
|
@ -30,6 +30,9 @@
|
|||
pkgs.gst_all_1.gst-plugins-good
|
||||
pkgs.gst_all_1.gst-plugins-ugly
|
||||
pkgs.gst_all_1.gstreamer
|
||||
pkgs.gst_all_1.gstreamer.dev
|
||||
pkgs.gst_all_1.gst-libav
|
||||
pkgs.gst_all_1.gst-vaapi
|
||||
pkgs.gtk4
|
||||
pkgs.libadwaita
|
||||
pkgs.librsvg
|
||||
|
|
|
@ -6,8 +6,10 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
pipewire = "0.8.0"
|
||||
gstreamer = { version = "0.23.0", features = ["serde", "v1_24"] }
|
||||
pipewire = { version = "0.8.0" }
|
||||
serde = { version = "1.0.209", features = ["alloc", "derive"] }
|
||||
serde_json = "1.0.127"
|
||||
serde_json = { version = "1.0.127" }
|
||||
tokio = { version = "1.39.3", features = ["full"] }
|
||||
warp = "0.3.7"
|
||||
warp = { version = "0.3.7" }
|
||||
glib = { version = "0.18" }
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
use gstreamer::prelude::*;
|
||||
use pipewire::{context::Context, main_loop::MainLoop};
|
||||
|
||||
fn main() {
|
||||
gstreamer::init();
|
||||
|
||||
// let srcfactory = gstreamer::ElementFactory::find("filesrc").unwrap().load().unwrap();
|
||||
let srcfactory = gstreamer::ElementFactory::find("videotestsrc")
|
||||
.unwrap()
|
||||
.load()
|
||||
.unwrap();
|
||||
let sinkfactory = gstreamer::ElementFactory::find("autovideosink")
|
||||
.unwrap()
|
||||
.load()
|
||||
.unwrap();
|
||||
let video_effect = gstreamer::ElementFactory::find("vertigotv")
|
||||
.unwrap()
|
||||
.load()
|
||||
.unwrap();
|
||||
|
||||
println!("source factory type: {:?}", srcfactory.element_type());
|
||||
println!("sink factory type: {:?}", sinkfactory.element_type());
|
||||
println!("video factory type: {:?}", video_effect.element_type());
|
||||
|
||||
let source = srcfactory.create().name("source").build().unwrap();
|
||||
let sink = sinkfactory.create().name("sink").build().unwrap();
|
||||
let filter = video_effect.create().name("filter").build().unwrap();
|
||||
|
||||
// let source = gstreamer::ElementFactory::make("videotestsrc");
|
||||
// let sink = gstreamer::ElementFactory::make("autovideosink");
|
||||
let pipeline = gstreamer::Pipeline::new();
|
||||
pipeline.add(&source).unwrap();
|
||||
pipeline.add(&sink).unwrap();
|
||||
pipeline.add(&filter).unwrap();
|
||||
source.link(&filter).unwrap();
|
||||
filter.link(&sink).unwrap();
|
||||
|
||||
pipeline.set_state(gstreamer::State::Playing).unwrap();
|
||||
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let msg = bus.timed_pop_filtered(
|
||||
gstreamer::ClockTime::NONE,
|
||||
&[gstreamer::MessageType::Error, gstreamer::MessageType::Eos],
|
||||
);
|
||||
|
||||
println!("message: {:?}", msg);
|
||||
|
||||
pipeline.set_state(gstreamer::State::Null);
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "1.77.0"
|
||||
channel = "1.80.1"
|
||||
targets = [ "wasm32-unknown-unknown", "thumbv6m-none-eabi" ]
|
||||
|
|
Loading…
Reference in New Issue