mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-10-31 22:59:14 +00:00
inspect: elements: List plugin, feature, element long name
This commit is contained in:
parent
b04dcca0b1
commit
92bdf9a63c
2 changed files with 34 additions and 2 deletions
|
@ -29,6 +29,7 @@ gst-rtsp = { package = "gstreamer-rtsp", path = "../gstreamer-rtsp", optional =
|
|||
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "../gstreamer-rtsp-server", optional = true }
|
||||
gst-allocators = { package = "gstreamer-allocators", path = "../gstreamer-allocators", optional = true }
|
||||
gio = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
|
||||
ansi_term = "0.12.1"
|
||||
anyhow = "1.0"
|
||||
derive_more = "0.99.5"
|
||||
futures = "0.3"
|
||||
|
|
|
@ -18,6 +18,37 @@
|
|||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use ansi_term::Color;
|
||||
use gst::prelude::*;
|
||||
|
||||
const BRBLUE: Color = Color::RGB(97, 127, 166);
|
||||
const PLUGIN_NAME_COLOR: Color = BRBLUE;
|
||||
const ELEMENT_NAME_COLOR: Color = Color::Green;
|
||||
|
||||
fn print_element_list() {
|
||||
let registry = gst::Registry::get();
|
||||
let mut plugins = registry.plugins();
|
||||
|
||||
plugins.sort_by(|p1, p2| p1.plugin_name().cmp(&p2.plugin_name()));
|
||||
for plugin in plugins {
|
||||
let mut features = registry.features_by_plugin(&plugin.plugin_name());
|
||||
|
||||
features.sort_by(|f1, f2| f1.name().cmp(&f2.name()));
|
||||
for feature in features {
|
||||
if let Some(element_factory) = feature.downcast_ref::<gst::ElementFactory>() {
|
||||
println!(
|
||||
"{}: {}: {}",
|
||||
PLUGIN_NAME_COLOR.paint(plugin.plugin_name().as_str()),
|
||||
ELEMENT_NAME_COLOR.paint(element_factory.name().as_str()),
|
||||
element_factory.longname()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
gst::init().unwrap();
|
||||
|
||||
print_element_list();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue