Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Conversation

MathieuDuponchelle
Copy link
Collaborator

No description provided.

@MathieuDuponchelle MathieuDuponchelle force-pushed the webrtcsink-encoder-setup branch from 5d77ad2 to 442f9fd Compare March 25, 2022 01:34
@MathieuDuponchelle MathieuDuponchelle merged commit 983fcf2 into main Mar 25, 2022
@sdroege sdroege deleted the webrtcsink-encoder-setup branch March 25, 2022 09:14
String::static_type().into(),
gst::Element::static_type().into(),
],
bool::static_type().into(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to

  • Use an accumulator function that causes the next handler to not be called anymore if false (or true, your decision) is returned
  • Have a default class handler that does the default setup (i.e. the configure_encoder() function)

That way applications can connect signal handlers before or after the class handler, and can decide if they just want to extend the behaviour or don't want the class handler to be called. Just like many such signals work in GTK for example.

false,
)?;

let encoder_was_configured: bool = element.emit_by_name(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

element.emit_by_name::<bool>(...) is what is generally used


info!("Encoder: {}", encoder.factory().unwrap().name());

let configured = match encoder.factory().unwrap().name().as_str() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You maybe want to get the factory (name) only once here, and also not panic if the element has no factory

.by_name("ws")
.unwrap();

ws.connect("encoder-setup", false, |values| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This false here makes it connect before the class handler btw, a true would be after.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants