art vanderlay
art vanderlay

Reputation: 2463

How to set the type for a non-standard gstreamer property?

I'm attempting to set the pattern property for the videotestsrc. Following the normal logic, I have tried setting the variable as an i32 and a string. Both fail with an error that asks for a specific type.

Looking in the gstreamer API, I could not see a way to set the property.

How do you force the type of a variable to match the expected?

let pattern = "snow";
src.set_property("pattern", &pattern)
    .expect("setting pattern error");

error message

thread 'main' panicked at 'setting pattern error: BoolError { message: "property \'pattern\' of type \'GstVideoTestSrc\' can\'t be set from the given type (expected: \'GstVideoTestSrcPattern\', got: \'gchararray\')",

Upvotes: 3

Views: 939

Answers (1)

Sebastian Dröge
Sebastian Dröge

Reputation: 2143

You can set it by string via src.set_property_from_str("snow").

Alternatively you can use the glib::EnumClass API to get all the possible values for the type. You can get the type via src.find_property("pattern") and then get_value_type() on it.

Upvotes: 4

Related Questions