inspect: elements: List plugin, feature, element long name

This commit is contained in:
Fabian Orccon 2023-05-28 01:53:18 +02:00
parent b04dcca0b1
commit 92bdf9a63c
2 changed files with 34 additions and 2 deletions

View file

@ -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"

View file

@ -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();
}